1、查看所有进程信息,但是只想获取COMMAND列的值
SDCxM-SDCAM-root-root> ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 2848 604 ? Ss 00:00 0:02 init
root 2 0.0 0.0 0 0 ? S 00:00 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S 00:00 0:02 [ksoftirqd/0]
root 4 0.0 0.0 0 0 ? S 00:00 0:00 [ksoftirqd/6]
root 5 0.0 0.0 0 0 ? S 00:00 0:00 [kworker/u:0]
root 6 0.0 0.0 0 0 ? S 00:00 0:00 [ksoftirqd/3]
root 7 0.0 0.0 0 0 ? S 00:00 0:00 [migration/0]
root 8 0.0 0.0 0 0 ? S 00:00 0:00 [ksoftirqd/1]
root 9 0.0 0.0 0 0 ? S 00:00 0:00 [ksoftirqd/5]
2、先获取单列的信息
SDCxM-SDCAM-root-root> ps aux | awk '{print $11}' //$11代指COMMAND这一列
COMMAND
[ksoftirqd/0]
[ksoftirqd/1]
[kworker/2:0]
[ksoftirqd/2]
[posixcputmr/3]
[migration/3]
[kworker/3:0]
[rcuc/3]
[ksoftirqd/3]
[ksoftirqd/4]
[ksoftirqd/5]
3、对单列的信息进行过滤,找到自己想要的信息
SDCxM-SDCAM-root-root> ps aux | awk '{print $11}' | grep ksoftirqd/[01356] //通过正则表达式对信息进行过滤
[ksoftirqd/0]
[ksoftirqd/1]
[ksoftirqd/3]
[ksoftirqd/5]
[ksoftirqd/6]
SDCxM-SDCAM-root-root>