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

后端 未结 13 574
梦谈多话
梦谈多话 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条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 17:08

    Full commandline

    For Linux & Unix System you can use ps -ef | grep process_name to get the full command line.

    On SunOS systems, if you want to get full command line, you can use

    /usr/ucb/ps -auxww | grep -i process_name
    

    To get the full command line you need to become super user.

    List of arguments

    pargs -a PROCESS_ID
    

    will give a detailed list of arguments passed to a process. It will output the array of arguments in like this:

    argv[o]: first argument
    argv[1]: second..
    argv[*]: and so on..
    

    I didn't find any similar command for Linux, but I would use the following command to get similar output:

    tr '\0' '\n' < /proc//environ
    

提交回复
热议问题