参考:https://askubuntu.com/questions/978711/how-do-i-split-a-proc-environ-file-in-separate-lines
命令如下:
cat /proc/30497/environ | xargs -0 -L1
- 30497 - 进程 ID
-0
- read null-delimited lines-L1
- read one line per execution of command
xargs 的其它参数
- -a
file read lines from file
所以上述命令也可以写成如下方式:
xargs -0 -L1 -a /proc/30497/environ