5

Possible Duplicate:
Finding the command for a specific PID in Linux from Python

I currently have a python process (and its pid, of course) and I wondered if it is possible to find out which script this process is running. (I use Ubuntu Linux 10.04.4 LTS)

4

1 に答える 1

8
cat /proc/${pid}/cmdline | tr '\0' ' '

cmdline疑似ファイルには、NUL で区切られた文字列のリストとして、プロセスのコマンド ライン引数が含まれています。このtrコマンドは、NUL をスペースに変換します。

于 2012-10-01T10:14:07.990 に答える