linux中查看进程

    技术2026-09-23  11

    想杀死fcitx进程,然后再重启它。

     

     

     

    root@zhangbin-laptop:/home/zhangbin# ps -e | grep 'fcitx'

     3405 ?        00:00:00 fcitx <defunct>

     3415 ?        00:00:02 fcitx

     

    不显示标题

    root@zhangbin-laptop:/home/zhangbin# ps -h

    Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html

      929 tty4     Ss+    0:00 /sbin/getty -8 38400 tty4

      936 tty5     Ss+    0:00 /sbin/getty -8 38400 tty5

      945 tty2     Ss+    0:00 /sbin/getty -8 38400 tty2

      946 tty3     Ss+    0:00 /sbin/getty -8 38400 tty3

      949 tty6     Ss+    0:00 /sbin/getty -8 38400 tty6

     1096 tty1     Ss+    0:00 /sbin/getty -8 38400 tty1

     3303 tty8     Ss+    0:28 /usr/bin/X :0 -br -verbose -auth /var/run/gdm/auth-fo

     3590 pts/0    S      0:00 su

     3598 pts/0    S      0:00 bash

     3621 pts/0    S      0:00 dbus-launch --autolaunch 3153116c74ee72bf74da76a44d30

     3787 pts/0    R+     0:00 ps -h

    显示所有进程 root@zhangbin-laptop:/home/zhangbin# ps -e   PID TTY          TIME CMD     1 ?        00:00:00 init     2 ?        00:00:00 kthreadd     3 ?        00:00:00 migration/0     4 ?        00:00:00 ksoftirqd/0     5 ?        00:00:00 watchdog/0     6 ?        00:00:00 events/0     7 ?        00:00:00 cpuset     8 ?        00:00:00 khelper     9 ?        00:00:00 netns    10 ?        00:00:00 async/mgr    11 ?        00:00:00 pm    12 ?        00:00:00 sync_supers    13 ?        00:00:00 bdi-default    14 ?        00:00:00 kintegrityd/0    15 ?        00:00:00 kblockd/0    16 ?        00:00:00 kacpid    17 ?        00:00:00 kacpi_notify    18 ?        00:00:00 kacpi_hotplug    19 ?        00:00:00 ata/0    20 ?        00:00:00 ata_aux    21 ?        00:00:00 ksuspend_usbd    22 ?        00:00:00 khubd    23 ?        00:00:00 kseriod    24 ?        00:00:00 kmmcd    27 ?        00:00:00 khungtaskd    28 ?        00:00:00 kswapd0    29 ?        00:00:00 ksmd    30 ?        00:00:00 aio/0    31 ?        00:00:00 ecryptfs-kthrea    32 ?        00:00:00 crypto/0    39 ?        00:00:00 scsi_eh_0    40 ?        00:00:00 scsi_eh_1    42 ?        00:00:00 kstriped    43 ?        00:00:00 kmpathd/0    44 ?        00:00:00 kmpath_handlerd    45 ?        00:00:00 ksnapd    46 ?        00:00:00 kondemand/0    47 ?        00:00:00 kconservative/0   252 ?        00:00:00 khpsbpkt   254 ?        00:00:00 knodemgrd_0   262 ?        00:00:00 jbd2/sda10-8   263 ?        00:00:00 ext4-dio-unwrit   296 ?        00:00:00 flush-8:0   323 ?        00:00:00 upstart-udev-br   327 ?        00:00:00 udevd   539 ?        00:00:00 kpsmoused   637 ?        00:00:00 i915   640 ?        00:00:00 jbd2/sda11-8   643 ?        00:00:00 ext4-dio-unwrit   652 ?        00:00:00 pccardd   654 ?        00:00:00 ipw2200/0   655 ?        00:00:00 udevd   681 ?        00:00:00 udevd   683 ?        00:00:00 ktpacpid   738 ?        00:00:00 jbd2/sda8-8   739 ?        00:00:00 ext4-dio-unwrit   778 ?        00:00:00 rsyslogd   787 ?        00:00:01 dbus-daemon   799 ?        00:00:00 gdm-binary   805 ?        00:00:00 avahi-daemon   807 ?        00:00:00 NetworkManager   809 ?        00:00:00 avahi-daemon   818 ?        00:00:00 modem-manager   822 ?        00:00:00 console-kit-dae   903 ?        00:00:00 wpa_supplicant   929 tty4     00:00:00 getty   936 tty5     00:00:00 getty   945 tty2     00:00:00 getty   946 tty3     00:00:00 getty   949 tty6     00:00:00 getty   951 ?        00:00:00 acpid   955 ?        00:00:00 anacron   960 ?        00:00:00 cron   961 ?        00:00:00 atd   996 ?        00:00:00 cupsd  1096 tty1     00:00:00 getty  1135 ?        00:00:00 upowerd  1139 ?        00:00:00 rtkit-daemon  1143 ?        00:00:00 polkitd  1291 ?        00:00:00 pulseaudio  1304 ?        00:00:00 gconf-helper  1316 ?        00:00:00 udisks-daemon  1317 ?        00:00:00 udisks-daemon  1434 ?        00:20:10 backend  1506 ?        00:00:00 system-service-  3252 ?        00:00:00 sh  3254 ?        00:00:00 run-parts  3258 ?        00:00:00 apt-xapian-inde  3259 ?        00:00:08 update-apt-xapi  3294 ?        00:00:00 gdm-simple-slav  3303 tty8     00:00:29 Xorg  3324 ?        00:00:00 dbus-launch  3339 ?        00:00:00 gdm-session-wor  3356 ?        00:00:00 gnome-keyring-d  3374 ?        00:00:00 gnome-session  3405 ?        00:00:00 fcitx <defunct>  3409 ?        00:00:00 ssh-agent  3412 ?        00:00:00 dbus-launch  3413 ?        00:00:00 dbus-daemon  3415 ?        00:00:03 fcitx  3417 ?        00:00:00 gconfd-2  3424 ?        00:00:00 gnome-settings-  3426 ?        00:00:00 gvfsd  3431 ?        00:00:00 gvfs-fuse-daemo  3435 ?        00:00:00 gnome-power-man  3437 ?        00:00:00 bluetooth-apple  3438 ?        00:00:02 gnome-panel  3439 ?        00:00:03 compiz  3440 ?        00:00:00 nautilus  3442 ?        00:00:00 nm-applet  3444 ?        00:00:00 polkit-gnome-au  3449 ?        00:00:00 syndaemon  3452 ?        00:00:00 gvfs-gdu-volume  3463 ?        00:00:00 gvfs-afc-volume  3466 ?        00:00:00 gvfs-gphoto2-vo  3468 ?        00:00:00 gvfsd-trash  3470 ?        00:00:00 bonobo-activati  3512 ?        00:00:00 trashapplet  3513 ?        00:00:02 wnck-applet  3526 ?        00:00:00 sh  3527 ?        00:00:00 gtk-window-deco  3535 ?        00:00:00 clock-applet  3536 ?        00:00:00 indicator-apple  3537 ?        00:00:00 indicator-apple  3538 ?        00:00:00 notification-ar  3544 ?        00:00:00 gvfsd-metadata  3546 ?        00:00:00 indicator-appli  3548 ?        00:00:00 indicator-messa  3550 ?        00:00:00 indicator-sound  3555 ?        00:00:00 indicator-sessi  3557 ?        00:00:00 gvfsd-burn  3559 ?        00:00:00 indicator-me-se  3562 ?        00:00:00 gnome-screensav  3568 ?        00:00:00 gdu-notificatio  3571 ?        00:00:00 gnome-terminal  3572 ?        00:00:00 gnome-pty-helpe  3573 pts/0    00:00:00 bash  3590 pts/0    00:00:00 su  3598 pts/0    00:00:00 bash  3610 ?        00:00:00 evolution-alarm  3611 ?        00:00:00 python  3616 ?        00:00:00 cat  3621 pts/0    00:00:00 dbus-launch  3622 ?        00:00:00 dbus-daemon  3658 ?        00:00:00 update-notifier  3678 ?        00:00:08 chrome  3681 ?        00:00:00 chrome  3683 ?        00:00:00 chrome  3741 ?        00:00:11 chrome  3766 ?        00:00:02 chrome  3779 ?        00:00:00 aptd  3789 pts/0    00:00:00 ps 全格式,显示终端上的进程。 root@zhangbin-laptop:/home/zhangbin# ps -f UID        PID  PPID  C STIME TTY          TIME CMD root      3590  3573  0 23:43 pts/0    00:00:00 su root      3598  3590  0 23:43 pts/0    00:00:00 bash root      3621     1  0 23:43 pts/0    00:00:00 dbus-launch --autolaunch 3153116 root      3790  3598  0 23:53 pts/0    00:00:00 ps -f 显示终端上的所有进程 root@zhangbin-laptop:/home/zhangbin# ps -a   PID TTY          TIME CMD  3590 pts/0    00:00:00 su  3598 pts/0    00:00:00 bash  3621 pts/0    00:00:00 dbus-launch  3791 pts/0    00:00:00 ps 显示所有者的信息 root@zhangbin-laptop:/home/zhangbin# ps -u Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND root       929  0.0  0.0   1792   464 tty4     Ss+  23:20   0:00 /sbin/getty -8 root       936  0.0  0.0   1792   468 tty5     Ss+  23:20   0:00 /sbin/getty -8 root       945  0.0  0.0   1792   468 tty2     Ss+  23:20   0:00 /sbin/getty -8 root       946  0.0  0.0   1792   468 tty3     Ss+  23:20   0:00 /sbin/getty -8 root       949  0.0  0.0   1792   468 tty6     Ss+  23:20   0:00 /sbin/getty -8 root      1096  0.0  0.0   1792   468 tty1     Ss+  23:20   0:00 /sbin/getty -8 root      3303  4.4  2.7  29932 20688 tty8     Ss+  23:42   0:33 /usr/bin/X :0 - root      3590  0.0  0.2   4692  1636 pts/0    S    23:43   0:00 su root      3598  0.0  0.2   4784  1852 pts/0    S    23:43   0:00 bash root      3621  0.0  0.0   3384   744 pts/0    S    23:43   0:00 dbus-launch --a root      3792  0.0  0.1   2716  1048 pts/0    R+   23:55   0:00 ps -u 统计当前进程数目 root@zhangbin-laptop:/home/zhangbin# ps -aux | wc Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html     154    1830   15628 root@zhangbin-laptop:/home/zhangbin# ps -aux | wc -l Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html 154 过滤特定进程数目 root@zhangbin-laptop:/home/zhangbin# ps aux | grep httpd | wc -l 1 root@zhangbin-laptop:/home/zhangbin# ps aux | grep httpd | wc       1      13      89 ======================

     ps命令最常用的还是用于监控后台进程的工作情况,因为后台进程是不和屏幕键盘这些标准输入/输出设备进行通信的,所以如果需要检测其情况,便可以使用ps命令了.   ps [选项]   下面对命令选项进行说明∶   -e显示所有进程.   -f全格式.   -h不显示标题.   -l长格式.   -w宽输出.   a显示终端上的所有进程,包括其他用户的进程.   r只显示正在运行的进程.   x显示没有控制终端的进程.   O[+|-] k1 [,[+|-] k2 [,…]] 根据SHORT KEYS、k1、k2中快捷键指定的多 级排序顺序显示进程列表.对于ps的不同格式都存在着默认的顺序指定.这些默 认顺序可以被用户的指定所覆盖.其中“+”字符是可选的,“-”字符是倒转指 定键的方向. 平时-   最常用的三个参数是u、a、x. 选项功能介绍-a显示所有终端中的进程。注意只有与终端关联的进程才会显示,那些守护进程或没有和终端关联的将不被显示。-x显示那些不关联终端的进程。-u显示进程所有者的信息-f显示进程的父进程信息-o对ps指令显示的信息进行定制,例如:pid、comm、%cpu、%mem、state、tty、euser、ruser

    最新回复(0)