当我ps -ef|grep python
得到以下信息时:
myusername 4492 2994 0 10:32 pts/0 00:00:01 /home/myusername/.virtualenvs/myproject/bin/ipython manage.py runserver
root 6665 1 0 10:42 ? 00:00:00 /usr/bin/python /usr/lib/system-service/system-service-d
myusername 14051 13497 0 11:28 pts/7 00:00:00 grep --color=auto python
如何仅获得正在运行该进程的用户,pid和为该进程运行的命令,如以下输出所示?
myusername 4492 /home/myusername/.virtualenvs/myproject/bin/ipython manage.py runserver
root 6665 /usr/bin/python /usr/lib/system-service/system-service-d
ps --fields="user pid command"