开发者

/proc directory script

I'm looking for a ruby script that accesses the /proc directory and saves the process ID and command line (cmdline) information 开发者_如何学Goin a file.


you may want to call ps instead of going to /proc.

cmd=`ps -eo pid,cmd`
o = File.open("output","w")
o.write(cmd)
o.close


you can also run below one liner bash script and redirect its output anywhere, as well as choose required argument option for head command.

ls -alR /proc/$(ls /proc/ |grep -i '[0-9]'|sort -n|head ) > /proc_open_files
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜