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

linux 查看进程cwd,linux shell 脚本查找进程cwd 求解相关推荐

  1. linux 查看gz文件,【shell 脚本】查看*.gz 文件的内容

    #!/bin/bash # zmore #使用'more'来查看gzip文件 NOARGS=65 NOTFOUND=66 NOTGZIP=67 if [ $# -eq 0 ] # 与if [ -z & ...

  2. linux shell脚本监控进程崩溃自动重启

    linux shell脚本监控进程崩溃自动重启,由于目前有Python实现的通讯组件时不时会异常中断,在还没有找到问题的解决办法时先暂时用shell监控并自动重启处理. # ! /bin/shbase ...

  3. linux shell 进程监控脚本,shell脚本监控进程

    直接以实例示范如何使用shell脚本实现对待监测进程的监测: 背景:服务器需要确保sendFlowMail.py脚本的运行. 思路:故编写一个shell脚本,按周期(60秒)判断该进程是否在运行,若未 ...

  4. linux cc脚本,Linux运维知识之Linux简单处理CC攻击shell脚本

    本文主要向大家介绍了Linux运维知识之Linux简单处理CC攻击shell脚本,通过具体的内容向大家展现,希望对大家学习Linux运维知识有所帮助. 第一个脚本是通过查找日志中访问次数过多的ip,并 ...

  5. Linux程序设计 读笔2 Shell脚本

    第二章 Shell程序设计 四.管道和重定向 1 重定向输出 ls -l > lsoutput.txt ps >> lsoutput.txt >>表示附加到一个文件中 文 ...

  6. Linux服务器监控cpu数据shell脚本

    Linux服务器监控cpu数据shell脚本 背景: 一种简易的监控进程的CPU.内存.线程数.句柄数的办法,使用shell脚本实现监控,Excel实现数据分析. #!/bin/bash#过滤出需要的 ...

  7. Linux 之旅 10:Shell 脚本

    Linux 之旅 10:Shell 脚本 (图片来自shell/bash脚本编程) Linux 上的 Shell 脚本可以看做是类似于Windows上的批处理程序(.bat)一样的东西,其本质就是将一 ...

  8. Linux系统一键安全加固shell脚本编写思路

    本次分享一下个人在对Linux系统一键安全加固shell脚本编写时的一些思路: Linux系统一键安全加固shell脚本编写思路 1.编写须知 1.1 脚本使用说明 1.2 主要功能说明: 1.3隐藏 ...

  9. LINUX下的流量监控shell脚本

    这篇文章主要介绍了LINUX下的流量监控shell脚本,可以适用任何Linux版本,需要的朋友可以参考下 一.脚本源码 # vi /etc/rc.d/traffic_monitor.sh ------ ...

最新文章

  1. 以下可以采用python语言保留字的是-以下选项中不是 Python 语言的保留字的是
  2. Linkis源码目录结构详解
  3. 数据库原理学习笔记(二)数据库范式
  4. 服务提供商应该如何帮助企业保护数据安全
  5. 51nod 1575 Gcd and Lcm
  6. android 自定义控件 焦点,android中设置控件获得焦点
  7. dataframe 一列的不同值_python数据分析包|Pandas-02之缺失值(NA)处理
  8. c++基础语句(条件判断)
  9. 机器学习算法在用户行为检测(UBA)领域的应用
  10. ASP.NET URL Rewrite. URL重写
  11. 实现视频播放器倍速、清晰度切换、m3u8下载功能
  12. Python常用的19个工具包汇总
  13. iOS设置App的名称和简单的版本国际化与本地化
  14. 博士申请 | 美国北卡州立大学胥栋宽老师招收深度学习方向全奖博士/硕士/博后...
  15. Google地图 Google Places API中附近搜索,文本搜索,地址搜索,地点详情的简单介绍
  16. 和风天气更新数据失败原因分析
  17. C#之CAD二次开发(8) 图形阵列
  18. 图片的旋转,缩放和拖拽
  19. 微信小程序-001-抽签功能-008-简单登录
  20. 如何安装tomcat服务器

热门文章

  1. 缓存(cache)与缓冲(buffer)
  2. 《Java并发编程实战》【第二部分 结构化并发应用程序】
  3. mysql里字典是什么意思_解析MySQL数据字典中的一些疑问
  4. 如何在敏捷转型中克服阻力 -- 邀请的力量
  5. python基础课程设计项目_python项目
  6. 充分利用集中采购的优势将采购组织打造成为利润中心
  7. 全面了解ESP-01SWiFi模块
  8. 【机器学习】- 仿射变换/仿射函数
  9. 记录第一次成功将vue项目打包并部署到centos云服务器上并访问(包含多个vue项目部署nginx配置说明)
  10. 支付宝支付成功异步通知收不到怎么办?