Linux中查看进程及杀死进程命令

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

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

3405 ?        00:00:00 fcitx <defunct>

3415 ?        00:00:02 fcitx

不显示标题


root@:/home/zhangbin# ps -h

Warning: bad ps syntax, perhaps a bogus '-'? See

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@:/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@:/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@:/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@:/home/zhangbin# ps -u
Warning: bad ps syntax, perhaps a bogus '-'? See /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

linux

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/25015.html