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

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

问题描述

在 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/ 中有更多信息,请查看.

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 系统上的正在运行的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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