Linux常用命令-pwdx

命令

pwdx

描述

report current working directory of a process
查看进程的工作目录

用法

1
pwdx [options] pid [...]

选项

注意

等同于lsof -p xxx | grep cwd命令

示例

1
2
3
4
5
6
7
8
9
10
11
12
$ pwdx 663
663: /
$ pwdx 2713
2713: /root
$ lsof -p 663 |grep cwd
chronyd 663 chrony cwd DIR 253,0 256 64 /
$ lsof -p 2713 |grep cwd
bash 2713 root cwd DIR 253,0 4096 33574977 /root
# 过滤指定进程并查看其工作目录
$ pwdx $(pgrep -d' ' ssh)
926: /
2681: /