Summer's Blog
酷炫主页
✨运维
🎉安装
👀踩坑
  • k8s
  • shell
  • python
  • redis
  • elasticsearch
  • mysql
  • ceph
  • spark
  • 关于
  • 思维
  • 命令
  • 友链
  • 分类
  • 标签
  • 归档
GitHub

Summer———夏苏文

💨运维界的前行者
酷炫主页
✨运维
🎉安装
👀踩坑
  • k8s
  • shell
  • python
  • redis
  • elasticsearch
  • mysql
  • ceph
  • spark
  • 关于
  • 思维
  • 命令
  • 友链
  • 分类
  • 标签
  • 归档
GitHub
  • vim使用技巧

  • zabbix使用技巧

  • linux使用技巧

    • 查看隐藏文件大小
    • 修改 hostname
    • 查看硬盘大小
    • 各种cd之间的区别汇总
    • 查看CPU个数
    • 查看当前目录文件数
    • rwxrwxr含义
    • 查看占用内存CPU最多进程
    • yum下载 RPM 包
    • rz命令和sz命令使用方法
    • 服务器ntp时间同步
    • ssh免密配置
    • samba的配置和使用
    • root盘满了怎么办
    • 如何替换jar中的jar配置
    • Linux启动流程
    • 统计脚本执行时间
    • 批量替换示例
    • 大文件切割技巧
    • 一条命令让CPU嗨起来
    • 记录服务器raid操作
    • linux测试网速
    • VM虚拟机扩容操作
    • linux如何快速删除大文件
    • 正则处理文本记录
    • linux测试硬盘读写操作
    • 根据进程查看文件位置
      • 查看nginx进程号
      • 根据进程号进入对应的proc
    • iostat查看硬盘读写速度
  • mysql使用技巧

  • docker使用技巧

  • k8s使用技巧

  • redis使用技巧

  • elasticsearch使用技巧

  • window使用技巧

  • nginx使用技巧

  • ansible使用技巧

  • 运维
  • linux使用技巧
summer
2021-04-09

根据进程查看文件位置

根据服务的进程PID,查看其运行的目录,启动命令或使用的文件等

# 查看nginx进程号

[root@OrncvW1001428 ~]# ps -ef | grep nginx
root      1053     1  0 3月21 ?       00:00:00 nginx: master process /www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf
www       1055  1053  0 3月21 ?       00:00:15 nginx: worker process
www       1056  1053  0 3月21 ?       00:00:28 nginx: worker process
www       1057  1053  0 3月21 ?       00:00:11 nginx: cache manager process
root     49128 48914  0 13:33 pts/0    00:00:00 grep --color=auto nginx
1
2
3
4
5
6

# 根据进程号进入对应的proc

[root@OrncvW1001428 ~]# cd  /proc/1053
[root@OrncvW1001428 1053]# ll
总用量 0
dr-xr-xr-x 2 root root 0 4月   2 16:27 attr
-rw-r--r-- 1 root root 0 4月   9 13:34 autogroup
-r-------- 1 root root 0 4月   9 13:34 auxv
-r--r--r-- 1 root root 0 4月   9 13:34 cgroup
--w------- 1 root root 0 4月   9 13:34 clear_refs
-r--r--r-- 1 root root 0 3月  21 01:34 cmdline
-rw-r--r-- 1 root root 0 4月   9 13:34 comm
-rw-r--r-- 1 root root 0 4月   9 13:34 coredump_filter
-r--r--r-- 1 root root 0 4月   9 13:34 cpuset
lrwxrwxrwx 1 root root 0 4月   9 13:34 cwd -> /
-r-------- 1 root root 0 4月   2 15:40 environ
lrwxrwxrwx 1 root root 0 4月   2 15:40 exe -> /www/server/nginx/sbin/nginx
dr-x------ 2 root root 0 3月  21 01:35 fd
dr-x------ 2 root root 0 4月   9 13:34 fdinfo
-rw-r--r-- 1 root root 0 4月   9 13:34 gid_map
-r-------- 1 root root 0 4月   9 13:34 io
-r--r--r-- 1 root root 0 4月   9 13:34 limits
-rw-r--r-- 1 root root 0 4月   9 13:34 loginuid
dr-x------ 2 root root 0 4月   9 13:34 map_files
-r--r--r-- 1 root root 0 4月   9 13:34 maps
-rw------- 1 root root 0 4月   9 13:34 mem
-r--r--r-- 1 root root 0 4月   9 13:34 mountinfo
-r--r--r-- 1 root root 0 4月   9 13:34 mounts
-r-------- 1 root root 0 4月   9 13:34 mountstats
dr-xr-xr-x 5 root root 0 4月   9 13:34 net
dr-x--x--x 2 root root 0 4月   9 13:34 ns
-r--r--r-- 1 root root 0 4月   9 13:34 numa_maps
-rw-r--r-- 1 root root 0 4月   9 13:34 oom_adj
-r--r--r-- 1 root root 0 4月   9 13:34 oom_score
-rw-r--r-- 1 root root 0 4月   9 13:34 oom_score_adj
-r--r--r-- 1 root root 0 4月   9 13:34 pagemap
-r-------- 1 root root 0 4月   9 13:34 patch_state
-r--r--r-- 1 root root 0 4月   9 13:34 personality
-rw-r--r-- 1 root root 0 4月   9 13:34 projid_map
lrwxrwxrwx 1 root root 0 4月   9 13:34 root -> /
-rw-r--r-- 1 root root 0 4月   9 13:34 sched
-r--r--r-- 1 root root 0 4月   9 13:34 schedstat
-r--r--r-- 1 root root 0 4月   9 13:34 sessionid
-rw-r--r-- 1 root root 0 4月   9 13:34 setgroups
-r--r--r-- 1 root root 0 4月   9 13:34 smaps
-r--r--r-- 1 root root 0 4月   9 13:34 stack
-r--r--r-- 1 root root 0 3月  21 01:34 stat
-r--r--r-- 1 root root 0 4月   2 15:40 statm
-r--r--r-- 1 root root 0 3月  21 01:34 status
-r--r--r-- 1 root root 0 4月   9 13:34 syscall
dr-xr-xr-x 3 root root 0 4月   9 13:34 task
-r--r--r-- 1 root root 0 4月   9 13:34 timers
-rw-r--r-- 1 root root 0 4月   9 13:34 uid_map
-r--r--r-- 1 root root 0 4月   9 13:34 wchan
[root@OrncvW1001428 1053]# 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  • cwd符号链接的是进程运行目录;
lrwxrwxrwx 1 root root 0 4月   9 13:34 cwd -> /
[root@OrncvW1001428 fd]# pwdx 1053
1053: /

1
2
3
4
  • exe符号连接就是执行程序的绝对路径;
lrwxrwxrwx 1 root root 0 4月   2 15:40 exe -> /www/server/nginx/sbin/nginx
1
  • cmdline就是程序运行时输入的命令行命令;
[root@OrncvW1001428 1053]# cat cmdline 
nginx: master process /www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf
1
2
  • environ记录了进程运行时的环境变量;
[root@OrncvW1001428 1053]# cat environ
nginx/conf/nginx.conf
1
2
  • fd目录下是进程打开或使用的文件的符号连接;
[root@OrncvW1001428 1053]# cd fd
[root@OrncvW1001428 fd]# ll
总用量 0
lrwx------ 1 root root 64 3月  21 01:35 0 -> /dev/null
lrwx------ 1 root root 64 3月  21 01:35 1 -> /dev/null
lrwx------ 1 root root 64 3月  21 01:35 10 -> socket:[17241]
lrwx------ 1 root root 64 3月  21 01:35 11 -> socket:[17242]
lrwx------ 1 root root 64 3月  21 01:35 12 -> socket:[19469]
lrwx------ 1 root root 64 3月  21 01:35 13 -> socket:[19470]
lrwx------ 1 root root 64 3月  21 01:35 14 -> socket:[19471]
lrwx------ 1 root root 64 3月  21 01:35 15 -> socket:[19472]
lrwx------ 1 root root 64 3月  21 01:35 16 -> socket:[19473]
l-wx------ 1 root root 64 3月  21 01:35 2 -> /www/wwwlogs/nginx_error.log
lrwx------ 1 root root 64 3月  21 01:35 3 -> socket:[19468]
l-wx------ 1 root root 64 3月  21 01:35 4 -> /www/wwwlogs/nginx_error.log
l-wx------ 1 root root 64 3月  21 01:35 5 -> /www/wwwlogs/access.log
l-wx------ 1 root root 64 3月  21 01:35 6 -> /dev/null
l-wx------ 1 root root 64 3月  21 01:35 7 -> /www/wwwlogs/www.xswsym.online.log
l-wx------ 1 root root 64 3月  21 01:35 8 -> /www/wwwlogs/www.xswsym.online.error.log
lrwx------ 1 root root 64 3月  21 01:35 9 -> socket:[17240]
[root@OrncvW1001428 fd]# 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
编辑
#linux
上次更新: 4/9/2021, 1:48:56 PM
linux测试硬盘读写操作
iostat查看硬盘读写速度

← linux测试硬盘读写操作 iostat查看硬盘读写速度→

最近更新
01
MongoDB使用iscsi
03-04
02
Python通过librbd操作ceph
02-28
03
安装SonarQube
02-07
更多文章>
Theme by Vdoing | Copyright © 2019-2022 夏苏文 | MIT License

网站已在灾难中运行:

总访问量 次 | 您是第 位访客
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式