如何获取传递给UNIX/Linux系统上正在运行的进程的命令行args? [英] How to get the command line args passed to a running process on unix/linux systems?

查看:103
本文介绍了如何获取传递给UNIX/Linux系统上正在运行的进程的命令行args?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在SunOS上,有pargs命令可打印传递给正在运行的进程的命令行参数.

On SunOS there is pargs command that prints the command line arguments passed to the running process.

在其他Unix环境上是否有任何类似的命令?

Is there is any similar command on other Unix environments?

推荐答案

有几种选择:

ps -fp <pid>
cat /proc/<pid>/cmdline | sed -e "s/\x00/ /g"; echo

在Linux上的/proc/<pid>中有更多信息,请看一看.

There is more info in /proc/<pid> on Linux, just have a look.

在其他Unix上,情况可能有所不同. ps命令将随处可用,/proc内容是特定于操作系统的.例如,在AIX上,/proc中没有cmdline.

On other Unixes things might be different. The ps command will work everywhere, the /proc stuff is OS specific. For example on AIX there is no cmdline in /proc.

这篇关于如何获取传递给UNIX/Linux系统上正在运行的进程的命令行args?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆