- 论坛徽章:
- 0
|
我在stackover上面问了一个问题,有个老外解答了,但是我不明白
ps aux | tr -s ' ' ' ' | cut -d' ' -f11- #中间这个tr -s ' ' ' '
请各位高手详细解答一下。
there is a file ,which you can get by command ps aux in linux.
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 2280 732 ? Ss 08:20 0:00 init [2]
root 327 0.0 0.1 2916 1456 ? Ss 08:20 0:00 udevd --daemon
root 1681 0.0 0.0 2376 800 ? Ss 08:20 0:00 /sbin/rpcbind -w
root 2071 0.0 0.1 27920 1708 ? Sl 08:20 0:00 /usr/sbin/rsyslogd -c5
i want to get the content of last field,such as:
COMMAND
init [2]
udevd --daemon
/sbin/rpcbind -w
/usr/sbin/rsyslogd -c5
when i use , $ awk '{print $11}' test,i get:
COMMAND
init
udevd
/sbin/rpcbind
/usr/sbin/rsyslogd
when i use ,$ awk '{print $12}' test,i get :
[2]
--daemon
-w
-c5
how can i do? |
|