恕我直言 ps -u
显示一个非常有用的输出,比 ps -u $USER
:
$ ps -u
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
elastic 234897 0.0 0.0 105980 1336 pts/2 S+ Oct10 0:00 /bin/bash ./run.sh collector-json-1.conf
elastic 234899 48.7 7.1 10087120 4433104 pts/2 Sl+ Oct10 2804:11 /usr/java/jdk1.7.0_09_x64/bin/java -Xmx6144m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Djava.awt.headless=true -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatin
:
相比
$ ps -u $USER
PID TTY TIME CMD
234897 pts/2 00:00:00 run.sh
234899 pts/2 1-22:44:04 java
:
- 但是,为什么它是“糟糕的语法”?
/usr/share/doc/procps-3.2.8/FAQ
无济于事。 - 什么是“正确的语法”来实现完全相同的输出?
如果它很重要:
$ uname -a
Linux h22k34.local 2.6.32-042stab044.17 #1 SMP Fri Jan 13 12:53:58 MSK 2012 x86_64 x86_64 x86_64 GNU/Linux