在使用 ps 的 bash shell 中,是否可以只返回进程名称 + PID 而没有它们的路径?例如,使用 ps -AI 得到如下结果:
Octo:~ decavolt$ ps -A
PID TTY TIME CMD
1 ?? 12:29.17 /sbin/launchd
10 ?? 0:01.37 /usr/libexec/kextd
11 ?? 7:03.37 /usr/sbin/DirectoryService
12 ?? 18:16.71 /usr/sbin/notifyd
...
我想看到的更像是:
PID TTY TIME CMD
1 ?? 12:29.17 launchd
10 ?? 0:01.37 kextd
11 ?? 7:03.37 DirectoryService
12 ?? 18:16.71 notifyd
...
编辑:对不起,我应该澄清这是在 OSX 10.5 和 10.6