linux 查看进程cwd,linux shell 脚本查找进程cwd 求解

root@center1:~/douyin/DYSECOO# ps -ef|grep msg_test

root 30228 29891 2 14:02 pts/4 00:00:40 python3 msg_test.py

上面是通过linux 命令查找得到的进程,然后通过进程查找得到下面的,我想要cwd 这个目录 ,linux 脚本如何写呢?root@center1:~/douyin/DYSECOO# ll /proc/30228

total 0

dr-xr-xr-x 9 root root 0 Feb 24 14:02 ./

dr-xr-xr-x 248 root root 0 Feb 5 18:48 ../

dr-xr-xr-x 2 root root 0 Feb 24 14:28 attr/

-rw-r--r-- 1 root root 0 Feb 24 14:28 autogroup

-r-------- 1 root root 0 Feb 24 14:28 auxv

-r--r--r-- 1 root root 0 Feb 24 14:28 cgroup

--w------- 1 root root 0 Feb 24 14:28 clear_refs

-r--r--r-- 1 root root 0 Feb 24 14:03 cmdline

-rw-r--r-- 1 root root 0 Feb 24 14:28 comm

-rw-r--r-- 1 root root 0 Feb 24 14:28 coredump_filter

-r--r--r-- 1 root root 0 Feb 24 14:28 cpuset

lrwxrwxrwx 1 root root 0 Feb 24 14:28 cwd -> /root/douyin/DYSECOO/

-r-------- 1 root root 0 Feb 24 14:28 environ

lrwxrwxrwx 1 root root 0 Feb 24 14:28 exe -> /usr/local/bin/python3.7*

dr-x------ 2 root root 0 Feb 24 14:03 fd/

dr-x------ 2 root root 0 Feb 24 14:03 fdinfo/

-rw-r--r-- 1 root root 0 Feb 24 14:28 gid_map

-r-------- 1 root root 0 Feb 24 14:28 io

-r--r--r-- 1 root root 0 Feb 24 14:28 latency

-r--r--r-- 1 root root 0 Feb 24 14:28 limits

-rw-r--r-- 1 root root 0 Feb 24 14:28 loginuid

dr-x------ 2 root root 0 Feb 24 14:28 map_files/

-r--r--r-- 1 root root 0 Feb 24 14:28 maps

-rw------- 1 root root 0 Feb 24 14:28 mem

-r--r--r-- 1 root root 0 Feb 24 14:28 mountinfo

-r--r--r-- 1 root root 0 Feb 24 14:28 mounts

-r-------- 1 root root 0 Feb 24 14:28 mountstats

dr-xr-xr-x 5 root root 0 Feb 24 14:28 net/

dr-x--x--x 2 root root 0 Feb 24 14:28 ns/

-r--r--r-- 1 root root 0 Feb 24 14:28 numa_maps

-rw-r--r-- 1 root root 0 Feb 24 14:28 oom_adj

-r--r--r-- 1 root root 0 Feb 24 14:28 oom_score

-rw-r--r-- 1 root root 0 Feb 24 14:28 oom_score_adj

-r--r--r-- 1 root root 0 Feb 24 14:28 pagemap

-r--r--r-- 1 root root 0 Feb 24 14:28 personality

-rw-r--r-- 1 root root 0 Feb 24 14:28 projid_map

lrwxrwxrwx 1 root root 0 Feb 24 14:28 root -> //

-rw-r--r-- 1 root root 0 Feb 24 14:28 sched

-r--r--r-- 1 root root 0 Feb 24 14:28 schedstat

-r--r--r-- 1 root root 0 Feb 24 14:28 sessionid

-r--r--r-- 1 root root 0 Feb 24 14:28 smaps

-r--r--r-- 1 root root 0 Feb 24 14:28 stack

-r--r--r-- 1 root root 0 Feb 24 14:03 stat

-r--r--r-- 1 root root 0 Feb 24 14:28 statm

-r--r--r-- 1 root root 0 Feb 24 14:27 status

-r--r--r-- 1 root root 0 Feb 24 14:28 syscall

dr-xr-xr-x 3 root root 0 Feb 24 14:28 task/

-r--r--r-- 1 root root 0 Feb 24 14:28 timers

-rw-r--r-- 1 root root 0 Feb 24 14:28 uid_map

-r--r--r-- 1 root root 0 Feb 24 14:28 wchan

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值