root@SmallWit:~# ps -Af
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 08:00 ? 00:00:03 /sbin/init earlyprintk
root 2 0 0 08:00 ? 00:00:00 [kthreadd]
root 3 2 0 08:00 ? 00:00:00 [kworker/0:0]
root 4 2 0 08:00 ? 00:00:00 [kworker/0:0H]
root 6 2 0 08:00 ? 00:00:00 [mm_percpu_wq]
root 7 2 0 08:00 ? 00:00:00 [ksoftirqd/0]
root 8 2 0 08:00 ? 00:00:00 [rcu_sched]
root 9 2 0 08:00 ? 00:00:00 [rcu_bh]
root 10 2 0 08:00 ? 00:00:00 [migration/0]
root 11 2 0 08:00 ? 00:00:00 [cpuhp/0]
root 12 2 0 08:00 ? 00:00:00 [kdevtmpfs]
root 13 2 0 08:00 ? 00:00:00 [netns]
root 14 2 0 08:00 ? 00:00:00 [oom_reaper]
root 15 2 0 08:00 ? 00:00:00 [writeback]
root 16 2 0 08:00 ? 00:00:00 [kcompactd0]
root 17 2 0 08:00 ? 00:00:00 [crypto]
root 18 2 0 08:00 ? 00:00:00 [kblockd]
root 19 2 0 08:00 ? 00:00:00 [cfg80211]
root 20 2 0 08:00 ? 00:00:00 [kworker/0:1]
root 21 2 0 08:00 ? 00:00:00 [watchdogd]
root 22 2 0 08:00 ? 00:00:00 [rpciod]
root 23 2 0 08:00 ? 00:00:00 [xprtiod]
root 24 2 0 08:00 ? 00:00:00 [kswapd0]
root 25 2 0 08:00 ? 00:00:00 [nfsiod]
root 50 2 0 08:00 ? 00:00:00 [irq/47-ft6236]
root 51 2 0 08:00 ? 00:00:00 [irq/23-sunxi-mm]
root 52 2 0 08:00 ? 00:00:00 [irq/24-sunxi-mm]
root 57 2 0 08:00 ? 00:00:01 [mmcqd/0]
root 58 2 0 08:00 ? 00:00:00 [kworker/0:1H]
root 59 2 0 08:00 ? 00:00:00 [jbd2/mmcblk0p2-]
root 60 2 0 08:00 ? 00:00:00 [ext4-rsv-conver]
root 72 2 0 08:00 ? 00:00:00 [kworker/u2:1]
root 79 1 0 08:00 ? 00:00:00 /lib/systemd/systemd-journald
root 92 1 0 08:00 ? 00:00:00 /lib/systemd/systemd-udevd
root 114 2 0 08:00 ? 00:00:00 [brcmf_wq/mmc1:0]
root 115 2 0 08:00 ? 00:00:00 [brcmf_wdog/mmc1]
root 124 2 0 08:00 ? 00:00:00 [ksdioirqd/mmc1]
root 229 1 0 08:00 ? 00:00:00 /usr/sbin/sshd -D
root 230 1 0 08:00 ? 00:00:00 /usr/sbin/NetworkManager --no-da
root 232 1 0 08:00 ? 00:00:00 /usr/sbin/ModemManager
root 236 1 0 08:00 ? 00:00:00 /usr/sbin/cron -f
root 238 1 0 08:00 ? 00:00:00 /lib/systemd/systemd-logind
message+ 240 1 0 08:00 ? 00:00:00 /usr/bin/dbus-daemon --system --
root 249 1 0 08:00 ? 00:00:00 /usr/lib/policykit-1/polkitd --n
root 251 1 0 08:00 tty1 00:00:00 /sbin/agetty --noclear tty1 linu
root 254 1 0 08:00 ttyS0 00:00:00 /bin/login --
root 257 1 0 08:00 ? 00:00:00 /usr/sbin/lightdm
root 268 257 0 08:00 tty7 00:00:01 /usr/bin/X :0 -seat seat0 -auth
root 275 1 0 08:00 ? 00:00:00 /sbin/wpa_supplicant -u -s -O /r
root 282 257 0 08:00 ? 00:00:00 lightdm --session-child 13 16
root 290 1 0 08:00 ? 00:00:00 /lib/systemd/systemd --user
root 293 290 0 08:00 ? 00:00:00 (sd-pam)
root 296 282 0 08:00 ? 00:00:00 /usr/bin/lxsession -s LXDE -e LX
root 311 296 0 08:00 ? 00:00:00 /usr/bin/ssh-agent x-session-man
root 320 296 0 08:00 ? 00:00:00 openbox --config-file /root/.con
root 323 296 0 08:00 ? 00:00:00 lxpolkit
root 325 296 0 08:00 ? 00:00:01 lxpanel --profile LXDE
root 326 296 0 08:00 ? 00:00:03 pcmanfm --desktop --profile LXDE
root 331 1 0 08:00 ? 00:00:00 /usr/bin/ssh-agent -s
root 340 1 0 08:00 ? 00:00:00 /usr/lib/menu-cache/menu-cached
root 352 254 0 08:00 ttyS0 00:00:00 -bash
root 358 2 0 08:06 ? 00:00:00 [kworker/u2:0]
root 365 2 0 08:08 ? 00:00:00 [kworker/0:2]
root 374 2 0 08:11 ? 00:00:00 [kworker/u2:2]
root 384 352 0 08:13 ttyS0 00:00:00 ps -Af
我用 ps -Af 有一半显示不出来.
离线
终于找到一个方法了, 先找到 pid, 然后 cat /proc/<pid>/cmdline
root@SmallWit:~# ps -Af |grep wpa
root 275 1 0 08:00 ? 00:00:00 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
root 406 352 0 08:24 ttyS0 00:00:00 grep wpa
root@SmallWit:~# cat /proc/275/cmdline
/sbin/wpa_supplicant-u-s-O/run/wpa_supplicant
root@SmallWit:~#
root@SmallWit:~#
离线
奇怪了, 上面的命令行参数居然没有空格.
离线
还是前面那个参考链接:
You can simply use:
ps -o args= -f -p ProcessPid
然后我再试了一下, 这次正常了.
root@SmallWit:~# ps -o args= -f -p 275
/sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
离线
ps显示不全,2楼方法正解。
离线