PHP Laravel NGINX html css Bootstrap Python Symfony Apache Windows linux jquery Django ASP vanilla Slim vagrant docker Homestead MySQL Redis Git SVN ssh Root vim PhpStorm Pycharm sass less PHP Laravel android html css Vue Angular React NGINX html css Javascript

Linux查看所有进程命令

原创

原创不易 ~ 转载请注明出处哦

Ubuntu 18.04/16.04 LTS为例,在Linux下,要查看当前命令窗运行的进程,我们可以使用ps命令:

eagle@EagleEye:~$ ps

  PID TTY          TIME CMD
 2250 pts/0    00:00:00 bash
 2294 pts/0    00:00:00 pycharm.sh
 2348 pts/0    00:00:50 java
 2383 pts/0    00:00:00 fsnotifier64
 2566 pts/0    00:00:00 ps

当然,要查看所有进程,我们可以给ps命令加上一些参数:

eagle@EagleEye:~$ ps -aux

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.4  0.1 159912  9256 ?        Ss   09:26   0:01 /sbin/init splash
root       276  0.0  0.2 103352 22348 ?        S<s  09:26   0:00 /lib/systemd/systemd-journald
systemd+   621  0.0  0.0  70864  6268 ?        Ss   09:26   0:00 /lib/systemd/systemd-resolved
systemd+   622  0.0  0.0 146096  3316 ?        Ssl  09:26   0:00 /lib/systemd/systemd-timesyncd
root       658  0.0  0.1 517792 13392 ?        Ssl  09:26   0:00 /usr/lib/udisks2/udisksd
syslog     663  0.0  0.0 263036  4304 ?        Ssl  09:26   0:00 /usr/sbin/rsyslogd -n
root       664  0.0  0.0  38428  3476 ?        Ss   09:26   0:00 /usr/sbin/cron -f
root       666  0.0  0.1 427256  9048 ?        Ssl  09:26   0:00 /usr/sbin/ModemManager
root       668  0.0  0.2 1288496 23060 ?       Ssl  09:26   0:00 /usr/lib/snapd/snapd
message+   669  0.2  0.0  51556  6020 ?        Ss   09:26   0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --
avahi      672  0.0  0.0  47076   344 ?        S    09:26   0:00 avahi-daemon: chroot helper
root       674  0.0  0.2 580588 19016 ?        Ssl  09:26   0:00 /usr/sbin/NetworkManager --no-daemon
root       675  0.0  0.0  44752  2804 ?        Ss   09:26   0:00 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
root       690  0.2  0.1 307484 12856 ?        Ssl  09:26   0:00 /usr/sbin/cups-browsed
root       708  0.0  0.1 311308 11248 ?        Ssl  09:26   0:00 /usr/lib/policykit-1/polkitd --no-debug
postgres   736  0.0  0.3 327408 27832 ?        S    09:26   0:00 /usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c co
root       749  0.0  0.1 308292  8456 ?        Ssl  09:26   0:00 /usr/sbin/gdm3
root       761  0.0  0.1 261768  8944 ?        Sl   09:26   0:00 gdm-session-worker [pam/gdm-launch-environment]
gdm        782  0.0  0.0  76888  7996 ?        Ss   09:26   0:00 /lib/systemd/systemd --user
gdm        783  0.0  0.0 114060  2624 ?        S    09:26   0:00 (sd-pam)
gdm        794  0.0  0.0 197908  5760 tty1     Ssl+ 09:26   0:00 /usr/lib/gdm3/gdm-wayland-session gnome-session --autostart /usr/share/g
gdm        796  0.0  0.0  50236  4468 ?        Ss   09:26   0:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile -
gdm        799  0.0  0.1 714716 15824 tty1     Sl+  09:26   0:00 /usr/lib/gnome-session/gnome-session-binary --autostart /usr/share/gdm/g
postgres   800  0.0  0.0 327408  4240 ?        Ss   09:26   0:00 postgres: 10/main: checkpointer process   
postgres   801  0.0  0.0 327408  4240 ?        Ss   09:26   0:00 postgres: 10/main: writer process   
postgres   802  0.0  0.1 327408  9128 ?        Ss   09:26   0:00 postgres: 10/main: wal writer process   
postgres   803  0.0  0.0 327808  6888 ?        Ss   09:26   0:00 postgres: 10/main: autovacuum launcher process   
postgres   804  0.0  0.0 182476  3548 ?        Ss   09:26   0:00 postgres: 10/main: stats collector process   
postgres   805  0.0  0.0 327716  5084 ?        Ss   09:26   0:00 postgres: 10/main: bgworker: logical replication launcher   
gdm        811  0.6  1.6 3347552 134536 tty1   Sl+  09:26   0:01 /usr/bin/gnome-shell
root       818  0.0  0.1 322332  8936 ?        Ssl  09:26   0:00 /usr/lib/upower/upowerd
gdm        831  0.0  0.6 540100 52676 tty1     Sl+  09:26   0:00 /usr/bin/Xwayland :1024 -rootless -terminate -accessx -core -listen 4 -l
gdm        838  0.0  0.1 365612  8508 ?        Ssl  09:26   0:00 /usr/lib/at-spi2-core/at-spi-bus-launcher
gdm        843  0.0  0.0  49928  3784 ?        S    09:26   0:00 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibi
gdm        845  0.0  0.0 220760  6960 ?        Sl   09:26   0:00 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session
gdm        849  0.0  0.1 1153748 11964 ?       Ssl  09:26   0:00 /usr/bin/pulseaudio --daemonize=no
rtkit      851  0.0  0.0 183504  2884 ?        SNsl 09:26   0:00 /usr/lib/rtkit/rtkit-daemon
gdm        868  0.0  0.1 375528  9892 tty1     Sl   09:26   0:00 ibus-daemon --xim --panel disable
gdm        871  0.0  0.1 294740  8408 tty1     Sl   09:26   0:00 /usr/lib/ibus/ibus-dconf
gdm        874  0.0  0.3 405220 29196 tty1     Sl   09:26   0:00 /usr/lib/ibus/ibus-x11 --kill-daemon
gdm        879  0.0  0.1 292684  8424 ?        Sl   09:26   0:00 /usr/lib/ibus/ibus-portal
whoopsie   884  0.0  0.1 395000 12936 ?        Ssl  09:26   0:00 /usr/bin/whoopsie -f
kernoops   886  0.0  0.0  56932   416 ?        Ss   09:26   0:00 /usr/sbin/kerneloops --test
kernoops   888  0.0  0.0  56932   420 ?        Ss   09:26   0:00 /usr/sbin/kerneloops
root       896  0.0  0.1 315404  9684 ?        Ssl  09:26   0:00 /usr/lib/x86_64-linux-gnu/boltd
root       897  1.8  0.4 457992 38004 ?        Ssl  09:26   0:04 /usr/lib/packagekit/packagekitd
gdm        898  0.0  0.3 553812 30400 tty1     Sl+  09:26   0:00 /usr/lib/gnome-settings-daemon/gsd-xsettings
gdm        899  0.0  0.1 294784  9028 tty1     Sl+  09:26   0:00 /usr/lib/gnome-settings-daemon/gsd-a11y-settings
gdm        902  0.0  0.3 404856 28672 tty1     Sl+  09:26   0:00 /usr/lib/gnome-settings-daemon/gsd-clipboard
gdm        958  0.0  0.1 219016  8284 tty1     Sl   09:26   0:00 /usr/lib/ibus/ibus-engine-simple
colord     998  0.0  0.2 339836 16572 ?        Ssl  09:26   0:00 /usr/lib/colord/colord
root      1016  0.0  0.1 267972  9064 ?        Sl   09:26   0:00 gdm-session-worker [pam/gdm-password]
root      1021  0.0  0.0  25652  6000 ?        S    09:26   0:00 /sbin/dhclient -d -q -sf /usr/lib/NetworkManager/nm-dhcp-helper -pf /run
eagle     1022  0.0  0.1  77004  8316 ?        Ss   09:26   0:00 /lib/systemd/systemd --user
eagle     1023  0.0  0.0 114060  2628 ?        S    09:26   0:00 (sd-pam)
eagle     1041  0.0  0.0 288360  7816 ?        Sl   09:26   0:00 /usr/bin/gnome-keyring-daemon --daemonize --login
eagle     1045  0.0  0.0 212124  5912 tty2     Ssl+ 09:26   0:00 /usr/lib/gdm3/gdm-x-session --run-script env GNOME_SHELL_SESSION_MODE=ub
eagle     1047  2.4  0.9 378952 79428 tty2     Sl+  09:26   0:06 /usr/lib/xorg/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority 
eagle     1053  0.0  0.0  50868  5096 ?        Ss   09:26   0:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile -
eagle     1056  0.0  0.2 651688 16264 tty2     Sl+  09:26   0:00 /usr/lib/gnome-session/gnome-session-binary --session=ubuntu
eagle     1135  0.0  0.0  11304   320 ?        Ss   09:26   0:00 /usr/bin/ssh-agent /usr/bin/im-launch env GNOME_SHELL_SESSION_MODE=ubunt
eagle     1138  0.0  0.0 291944  7168 ?        Ssl  09:26   0:00 /usr/lib/gvfs/gvfsd
eagle     1143  0.0  0.0 432036  8044 ?        Sl   09:26   0:00 /usr/lib/gvfs/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes
eagle     1152  0.0  0.1 367992  8800 ?        Ssl  09:26   0:00 /usr/lib/at-spi2-core/at-spi-bus-launcher
eagle     1157  0.0  0.0  49928  4220 ?        S    09:26   0:00 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibi
eagle     1159  0.0  0.0 220784  6924 ?        Sl   09:26   0:00 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session
eagle     1318  0.0  0.0 275864  4728 ?        Ssl  09:26   0:00 /usr/lib/gvfs/gvfs-mtp-volume-monitor
eagle     1322  0.0  0.0 288652  6548 ?        Ssl  09:26   0:00 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
eagle     1326  0.0  0.2 527388 23624 tty2     Sl+  09:26   0:00 /usr/lib/gnome-settings-daemon/gsd-power
eagle     1372  0.0  0.2 508144 22088 tty2     Sl+  09:26   0:00 /usr/lib/gnome-settings-daemon/gsd-keyboard
eagle     1376  0.0  0.3 1089860 24576 tty2    Sl+  09:26   0:00 /usr/lib/gnome-settings-daemon/gsd-media-keys
eagle     1379  0.0  0.1 296664  8328 tty2     Sl+  09:26   0:00 /usr/lib/gnome-settings-daemon/gsd-mouse
eagle     1574  0.0  0.0 298152  7208 ?        Ssl  09:26   0:00 /usr/lib/glib-networking//glib-pacrunner
eagle     1596  8.3  6.3 3482764 516508 tty2   SLl+ 09:26   0:19 /usr/lib/chromium-browser/chromium-browser --enable-pinch
eagle     1605  0.0  0.4 418900 39292 tty2     S+   09:26   0:00 /usr/lib/chromium-browser/chromium-browser --type=zygote
eagle     1607  0.0  0.3 418900 29952 tty2     S+   09:26   0:00 /usr/lib/chromium-browser/chromium-browser --type=zygote
eagle     1633  2.7  1.3 1133104 105228 tty2   Sl+  09:26   0:06 /usr/lib/chromium-browser/chromium-browser --type=gpu-process --field-tr
eagle     1687  0.0  0.4 531824 35380 tty2     S+   09:26   0:00 /usr/lib/chromium-browser/chromium-browser --type=-broker
eagle     1725  0.7  1.1 1964424 95212 tty2    Sl+  09:26   0:01 /usr/lib/chromium-browser/chromium-browser --type=renderer --field-trial
root      2148  0.0  0.0      0     0 ?        I    09:27   0:00 [kworker/2:3]
root      2151  0.0  0.0      0     0 ?        I    09:27   0:00 [kworker/1:4]
eagle     2172  0.0  0.2 600592 23440 tty2     Sl+  09:27   0:00 update-notifier
eagle     2239  0.5  0.6 822004 56416 tty2     Sl+  09:28   0:00 /usr/bin/python3 /usr/bin/guake
eagle     2250  0.0  0.0  30348  5688 pts/0    Ss   09:28   0:00 /bin/bash
eagle     2258  0.0  0.0      0     0 tty2     Z+   09:28   0:00 [gsettings] <defunct>
eagle     2284  0.0  0.4 118225492 32340 tty2  Sl+  09:28   0:00 /usr/lib/deja-dup/deja-dup-monitor
eagle     2294  0.0  0.0   4628  1644 pts/0    S    09:28   0:00 /bin/sh /home/eagle/Programming/pycharm/bin/pycharm.sh
eagle     2348 46.8  7.6 4686376 616044 pts/0  Sl   09:28   0:51 /home/eagle/Programming/pycharm/jre64/bin/java -classpath /home/eagle/Pr
eagle     2383  0.0  0.0   5308  2136 pts/0    S    09:28   0:00 /home/eagle/Programming/pycharm/bin/fsnotifier64
eagle     2575  0.0  0.0  46772  3536 pts/0    R+   09:30   0:00 ps -aux

由于进程太多,我略去了一部分进程,但是可以看到,a选项表示我们想查看所有用户的进程,u选项显示进程属于的用户,而x选项会显示未在命令窗口(Terminal)中运行的进程。


正在加载验证码......
请先完成验证