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

后端 未结 13 637
梦谈多话
梦谈多话 2020-11-30 16:57

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 env

13条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 17:03

    Another variant of printing /proc/PID/cmdline with spaces in Linux is:

    cat -v /proc/PID/cmdline | sed 's/\^@/\ /g' && echo
    

    In this way cat prints NULL characters as ^@ and then you replace them with a space using sed; echo prints a newline.

提交回复
热议问题