一、ps aux -> BSD语法
1. ps a -> 显示所有用户的程序
1-1. ps aux 和 ps ux 对比
1-1-1. ps aux 列出了所有用户的进程
peng@peng-vmware:~/Desktop$ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 24800 0.2 1.6 80572 32532 pts/1 S+ 08:31 0:25 /usr/lib/git-core/git index-pack --stdin -v --fix-thin --keep=fetch-pack 24774 on peng-vmware --pack_header=2,710
peng 25268 0.0 0.4 49172 9356 pts/0 T 09:36 0:00 vim a.txt
root 26840 0.0 0.0 0 0 ? I 10:40 0:00 [kworker/u256:2]
root 26898 0.0 0.0 0 0 ? I 11:03 0:00 [kworker/u256:1]
root 26973 0.0 0.0 0 0 ? I 11:20 0:00 [kworker/u256:0]
peng 26991 0.0 0.1 41416 3560 pts/0 R+ 11:25 0:00 ps aux
1-1-2. ps ux 只列出了当前用户的进程(你自己)
peng@peng-vmware:~/Desktop$ps aux
peng 2143 0.0 0.6 2604444 13152 ? Sl 8月29 0:05 /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 1246 -prefM
peng 2168 0.0 3.5 2663836 70808 ? Sl 8月29 0:11 /usr/lib/firefox/firefox -contentproc -childID 5 -isForBrowser -prefsLen 7381 -prefM
peng 2299 0.0 0.2 2564040 6020 ? Sl 8月29 0:00 /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -prefsLen 9836 -prefM
peng 2833 0.0 0.3 1030832 7956 tty1 Sl+ 8月29 0:34 /usr/bin/python /usr/bin/autokey-gtk -c
peng 3183 0.0 0.1 24600 3752 pts/1 Ss 8月29 0:00 bash
peng 25268 0.0 0.4 49172 9356 pts/0 T 09:36 0:00 vim a.txt
peng 27007 0.0 0.1 41416 3528 pts/0 R+ 11:30 0:00 ps ux
2. ps x -> 显示所有进程,不以终端区分,既列出包含终端的进程和也列出不包含终端的进程
2-1. ps aux 和 ps au 对比
2-1-1. ps aux 列出了所有进程,?的是不包含终端的进程,tty和pts的是终端进程
peng 1573 0.1 0.3 444780 6504 tty1 Sl+ 8月29 1:22 /usr/bin/vmtoolsd -n vmusr --blockFd 3
peng 1574 0.0 0.0 271936 784 tty1 Sl+ 8月29 0:00 /usr/lib/gnome-disk-utility/gsd-disk-utility-notify
peng 1646 0.0 0.0 727424 1188 ? Ssl 8月29 0:00 /usr/lib/evolution/evolution-addressbook-factory
peng 1654 0.0 0.0 880732 544 ? Sl 8月29 0:00 /usr/lib/evolution/evolution-addressbook-factory-subprocess --factory all --bus-name
peng 1655 0.0 0.0 199532 1592 tty1 Sl 8月29 0:04 /usr/lib/ibus/ibus-engine-simple
peng 1679 0.0 0.5 2774328 10872 tty1 Sl+ 8月29 0:01 /usr/bin/copyq monitorClipboard
root 24415 0.0 1.2 376080 24788 pts/1 Sl+ 08:30 0:03 /usr/bin/python /home/peng/Desktop/rockchip/repo/main.py --repo-dir=/home/peng/Deskto
root 24760 0.0 0.1 20672 3624 pts/1 S+ 08:31 0:00 git fetch --progress rockchip-linux --tags +refs/tags/*:refs/tags/* +refs/heads/*:ref
2-1-2. ps au 只列出包含终端的进程
peng@peng-vmware:~/Desktop$ ps au
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
peng 1070 0.0 0.0 206776 1112 tty1 Ssl+ 8月29 0:00 /usr/lib/gdm3/gdm-x-session --run-script env GNOME_SHELL_SESSION_MODE=ubuntu gnome-s
peng 1072 0.2 2.3 483096 47688 tty1 Rl+ 8月29 3:06 /usr/lib/xorg/Xorg vt1 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -background
peng 1171 0.0 0.0 627564 1972 tty1 Sl+ 8月29 0:00 /usr/lib/gnome-session/gnome-session-binary --session=ubuntu
3. ps u -> 显示用户信息
没有u的话,没有用户信息,既没有uid这个column
二、ps -ef -> 标准语法
4. ps -e -> 显示所有进程
peng@peng-vmware:~/Desktop$ ps -e
PID TTY TIME CMD
1 ? 00:00:05 systemd
2 ? 00:00:00 kthreadd
3 ? 00:00:00 kworker/0:0
4 ? 00:00:00 kworker/0:0H
6 ? 00:00:00 mm_percpu_wq
7 ? 00:01:07 ksoftirqd/0
5. ps -f -> 显示所有column
peng@peng-vmware:~/Desktop$ ps -f
UID PID PPID C STIME TTY TIME CMD
peng 1789 1779 0 8月29 pts/0 00:00:00 bash
peng 25268 1789 0 09:36 pts/0 00:00:00 vim a.txt
peng 27052 1789 0 11:46 pts/0 00:00:00 ps -f