How to parse /proc/pid/cmdline

前端 未结 7 2039
盖世英雄少女心
盖世英雄少女心 2021-02-01 18:51

I\'m trying to split the cmdline of a process on Linux but it seems I cannot rely on it to be separated by \'\\0\' characters. Do you know why sometimes the \'\\0\' character is

7条回答
  •  情书的邮戳
    2021-02-01 19:25

    Use

    cat /proc/2634/cmdline | tr "\0" " "
    

    to get the args separated by blanks, as you would see it on a command line.

提交回复
热议问题