简体   繁体   English

如何在linux命令行中查看进程的命令行和环境变量

[英]How to view the command line and environment variables for a process in the linux command line

I'd like to be able to see both the command line that launch a given process (by PID) and the its environment variables. 我希望能够看到启动给定进程的命令行(通过PID)及其环境变量。

Preferably from a command line but a script would be acceptable failing that. 最好是从命令行,但脚本是可以接受的失败。

This would be on Centos 5.3 but the more widely it works the better. 这将在Centos 5.3上,但它的工作范围越广越好。

cat /proc/$pid/environ
cat /proc/$pid/cmdline

where $pid is the pid you are interested in 其中$ pid是你感兴趣的pid

ps -ef is a quick way to get the command line args for everything. ps -ef是一种快速获取命令行args的方法。 grep to your hearts delight! grep让你高兴的是!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM