8

Is there a way to find out for any given process with which parameters it was started?

2 Answers 2

5

To find what arguments were passed to pdnsd, I'd do:

[~]> pgrep -l pdnsd
1373 pdnsd
[~]> cat /proc/1373/cmdline 
/usr/sbin/pdnsd--daemon-p/var/run/pdnsd.pid[~]> 

(cmdline file entries are separated by null characters; use something like tr '\0' '\n' </proc/<pid>/cmdline to see more legible output.)

/proc/<pid>/ contains a lot of information.

2
  • Note that the command line can be overwritten by the program itself; certain pieces of software do this for benign reasons, usually to put useful human-readable information in the ps output, but also malign reasons like an exploit or rootkit trying to hide itself.
    – Shadur
    Jun 8, 2011 at 9:56
  • Way too complex. Why not just pgrep -a pdnsd? Mar 9, 2018 at 3:47
4

For Linux, ps -ef yields the whole command line including the parameters.

For Solaris, things could be more problematic but you tagged the question with Linux...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.