Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the command line args passed to a running process on unix/linux systems?

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

Is there is any similar command on other Unix environments?

like image 520
Hemant Avatar asked May 04 '09 20:05

Hemant


People also ask

Which command in Unix is used to display the list of currently running processes?

To list currently running processes, use the ps , top , htop , and atop Linux commands. You can also combine the ps command with the pgrep command to identify individual processes.

How do I check running processes in Unix using PID?

The easiest way to find out if process is running is run ps aux command and grep process name. If you got output along with process name/pid, your process is running.


1 Answers

There are several options:

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

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

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.

like image 149
markus_b Avatar answered Sep 29 '22 03:09

markus_b