LoginSignup
6
4

More than 5 years have passed since last update.

プロセスの実行ディレクトリを確認する

Posted at

VSCode の、ソースコードフォーマットが実施されないので何やってるのか確認してみたのでメモ

対象のプロセス番号を確認する。

今回は clang-format のプロセスを探したかったので format で grep.

asladagsx@ubuntu:~$ ps -aux | grep format
asladagsx   7363  0.0  0.2  48668  8356 ?        S    14:05   0:00 /usr/bin/clang-format-3.9 -style=file -fallback-style=LLVM -assume-filename=/home/asladagsx/w2/trunk/test/test.cc
asladagsx  21803  0.0  0.0   4696   836 pts/0    S+   16:10   0:00 grep --color=auto format
asladagsx@ubuntu:~$ 

プロセス番号が 7363 とわかった。

プロセスの情報を取得

/proc/プロセス番号/cwd を ls -al すると実行中プロセスのカレントディレクトリがとれた。

asladagsx@ubuntu:~$ ls -al /proc/7363/cwd
lrwxrwxrwx 1 asladagsx asladagsx 0  5月 17 16:16 /proc/7363/cwd -> /home/asladagsx/w2/trunk/test
asladagsx@ubuntu:~$ 
6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4