失常的ps命令是打印进去PID TTY TIME CMD四个字段
PID TTY TIME CMD 5131 ttys000 0:00.20 -zsh14330 ttys000 0:00.46 ios_webkit_debug_proxy -f chrome-devtools://devtools/b60457 ttys001 0:00.31 -zsh 7097 ttys002 0:00.14 -zsh88776 ttys003 0:00.22 -zsh 4748 ttys004 0:07.38 /Library/Frameworks/Python.framework/Versions/3.8/Reso76131 ttys004 0:00.59 -zsh16212 ttys005 0:00.24 -zsh42452 ttys005 0:03.67 /usr/bin/java -jar UICrawler-2.0.jar -u d4917fbadf4b7128402 ttys006 0:00.28 -zsh43381 ttys009 0:00.15 -zsh
看到挺诡异的没,CMD内容过长被截断了,UICrawler这一行自身很长,如何显示出残缺的门路呢,ps -f 打印出残缺信息(起初发现这个把终端宽度拖宽一点就能够显示了,他只是一行显示不下不回换行,害我弄良久,垃圾,ps -f默认应该是能够多行显示)
ps -f UID PID PPID C STIME TTY TIME CMD 501 5131 5130 0 10:02上午 ttys000 0:00.20 -zsh 501 14330 5131 0 10:17上午 ttys000 0:00.48 ios_webkit_debug_proxy -f chrome-devtools://devtools/bundled/inspector.html 501 60457 60456 0 四10上午 ttys001 0:00.31 -zsh 501 88776 88775 0 12:27下午 ttys003 0:00.22 -zsh 501 4748 76131 0 10:01上午 ttys004 0:07.53 /Library/Frameworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python ocrServer.py 501 76131 76130 0 4:36下午 ttys004 0:00.59 -zsh 501 16212 16211 0 10:19上午 ttys005 0:00.24 -zsh 501 47021 16212 0 2:30下午 ttys005 0:04.07 /usr/bin/java -jar UICrawler-2.0.jar -u d4917fbadf4b71db3c9b3a835f100099b0432442 -s 127.0.0.1 -t 4723 -f config_ios.yml -b com.tencent.weread -o out_file -log 501 48459 47021 0 2:33下午 ttys005 0:00.01 /usr/local/bin/idevicescreenshot -u d4917fbadf4b71db3c9b3a835f100099b0432442 out_file/del.png 501 43381 43380 0 2:24下午 ttys009 0:00.18 -zsh
内容是齐全了,怎么能力把除了CMD字段的其余内容去掉ps -fo command?
ijm@172-10-20-5 ~ % ps -fo command UID PID PPID C STIME TTY TIME CMD COMMAND 501 5131 5130 0 10:02上午 ttys000 0:00.20 -zsh -zsh 501 14330 5131 0 10:17上午 ttys000 0:00.49 ios_webkit_debug ios_webkit_debug_proxy -f chrome-devtools://devtools/bundled/inspector.html 501 60457 60456 0 四10上午 ttys001 0:00.31 -zsh -zsh 501 52840 52839 0 2:40下午 ttys002 0:00.15 -zsh -zsh 501 88776 88775 0 12:27下午 ttys003 0:00.22 -zsh -zsh 501 4748 76131 0 10:01上午 ttys004 0:07.66 /Library/Framewo /Library/Frameworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python ocrServer.py 501 76131 76130 0 4:36下午 ttys004 0:00.59 -zsh -zsh 501 16212 16211 0 10:19上午 ttys005 0:00.24 -zsh -zsh 501 50840 16212 0 2:38下午 ttys005 0:03.91 /usr/bin/java -j /usr/bin/java -jar UICrawler-2.0.jar -u d4917fbadf4b71db3c9b3a835f100099b0432442 -s 127.0.0.1 -t 4723 -f config_ios.yml -b com.tencent.weread -o out_file -log
不行啊-f会把所有的字段显示进去,起初搜寻ps -o command
ijm@172-10-20-5 ~ % ps -o commandCOMMAND-zshios_webkit_debug_proxy -f chrome-devtools://devtools/bundled/inspector.html-zsh-zsh-zsh/Library/Frameworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python ocrServer.py-zsh-zsh/usr/bin/java -jar UICrawler-2.0.jar -u d4917fbadf4b71db3c9b3a835f100099b0432442 -s 127.0.0.1 -t 4723 -f config_ios.yml -b com.tencent.weread -o out_file -log
这里只会展现终端启动的一些过程,没有终端的过程是显示不进去.命令-A或-e解决这个问题ps -Ao command或ps -eo command
最终命令我要搜寻UICrawler过程:
ps -Ao command |grep UICrawler
ijm@172-10-20-5 ~ % ps -Ao command |grep UICrawlergrep UICrawler/usr/bin/java -jar UICrawler-2.0.jar -u d4917fbadf4b71db3c9b3a835f100099b0432442 -s 127.0.0.1 -t 4723 -f config_ios.yml -b com.tencent.weread -o out_file -log