Linux下查看某个进程文件的启动位置

Linux下查看某个进程文件的启动位置

找到进程ID,进入【/proc/进程ID】,并通过 ls -al查看:

[mubai@localhost test]$ ps -ef | grep zookeeper
... #得到进程号
[mubai@localhost test]$ ll /proc/21586
total 0
dr-xr-xr-x  2 root root 0 Dec  4 14:07 attr
-rw-r--r--  1 root root 0 Dec  4 14:07 autogroup
-r--------  1 root root 0 Dec  4 14:07 auxv
-r--r--r--  1 root root 0 Dec  4 14:07 cgroup
--w-------  1 root root 0 Dec  4 14:07 clear_refs
-r--r--r--  1 root root 0 Dec  4 09:48 cmdline
-rw-r--r--  1 root root 0 Dec  4 14:07 comm
-rw-r--r--  1 root root 0 Dec  4 14:07 coredump_filter
-r--r--r--  1 root root 0 Dec  4 14:07 cpuset
lrwxrwxrwx  1 root root 0 Dec  4 14:07 cwd -> /home/soft/zookeeper/bin
-r--------  1 root root 0 Dec  4 14:07 environ
lrwxrwxrwx  1 root root 0 Dec  4 09:48 exe -> /usr/local/java/jdk1.8.0_171/bin/java
dr-x------  2 root root 0 Dec  4 09:48 fd
dr-x------  2 root root 0 Dec  4 14:07 fdinfo
-rw-r--r--  1 root root 0 Dec  4 14:07 gid_map
-r--------  1 root root 0 Dec  4 14:07 io
-r--r--r--  1 root root 0 Dec  4 14:07 limits
-rw-r--r--  1 root root 0 Dec  4 14:07 loginuid
dr-x------  2 root root 0 Dec  4 14:07 map_files
-r--r--r--  1 root root 0 Dec  4 09:48 maps
-rw-------  1 root root 0 Dec  4 14:07 mem
-r--r--r--  1 root root 0 Dec  4 14:07 mountinfo
-r--r--r--  1 root root 0 Dec  4 14:07 mounts
-r--------  1 root root 0 Dec  4 14:07 mountstats
dr-xr-xr-x  6 root root 0 Dec  4 09:48 net
dr-x--x--x  2 root root 0 Dec  4 14:07 ns
-r--r--r--  1 root root 0 Dec  4 14:07 numa_maps
-rw-r--r--  1 root root 0 Dec  4 14:07 oom_adj
-r--r--r--  1 root root 0 Dec  4 14:07 oom_score
-rw-r--r--  1 root root 0 Dec  4 14:07 oom_score_adj
-r--r--r--  1 root root 0 Dec  4 14:07 pagemap
-r--r--r--  1 root root 0 Dec  4 14:07 personality
-rw-r--r--  1 root root 0 Dec  4 14:07 projid_map
lrwxrwxrwx  1 root root 0 Dec  4 14:07 root -> /
-rw-r--r--  1 root root 0 Dec  4 14:07 sched
-r--r--r--  1 root root 0 Dec  4 14:07 schedstat
-r--r--r--  1 root root 0 Dec  4 14:07 sessionid
-rw-r--r--  1 root root 0 Dec  4 14:07 setgroups
-r--r--r--  1 root root 0 Dec  4 14:07 smaps
-r--r--r--  1 root root 0 Dec  4 14:07 stack
-r--r--r--  1 root root 0 Dec  4 09:48 stat
-r--r--r--  1 root root 0 Dec  4 10:34 statm
-r--r--r--  1 root root 0 Dec  4 09:48 status
-r--r--r--  1 root root 0 Dec  4 14:07 syscall
dr-xr-xr-x 68 root root 0 Dec  4 14:07 task
-r--r--r--  1 root root 0 Dec  4 14:07 timers
-rw-r--r--  1 root root 0 Dec  4 14:07 uid_map
-r--r--r--  1 root root 0 Dec  4 14:07 wchan

其中:
cwd符号链接的是进程运行目录;
exe符号连接就是执行程序的绝对路径;
cmdline为程序运行时输入的命令行命令;
environ记录了进程运行时的环境变量;
fd目录下是进程打开或使用的文件的符号连接;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值