有时候追查linux中某个程序进程,通过ps只看见运行命令,通过以下方式可以看见程序的安装路径:
[root@sor-manager-01 ~]# ps aux|grep grafanaroot 15894 0.6 0.0 4969960 53164 ? Sl Oct24 221:58 ./grafana-serverroot 21348 0.0 0.0 112660 2220 pts/12 S+ 13:50 0:00 grep --color=auto grafana# /proc/是程序进程信息,本例中grafana-server的当前进程是15894[root@sor-manager-01 ~]# ls -l /proc/15894total 0dr-xr-xr-x 2 root root 0 Nov 17 11:12 attr-rw-r--r-- 1 root root 0 Nov 17 11:14 autogroup-r-------- 1 root root 0 Nov 17 11:14 auxv-r--r--r-- 1 root root 0 Nov 17 11:14 cgroup--w------- 1 root root 0 Nov 17 11:14 clear_refs-r--r--r-- 1 root root 0 Oct 24 16:43 cmdline-rw-r--r-- 1 root root 0 Nov 17 11:14 comm-rw-r--r-- 1 root root 0 Nov 17 11:14 coredump_filter-r--r--r-- 1 root root 0 Nov 17 11:14 cpusetlrwxrwxrwx 1 root root 0 Nov 17 11:14 cwd -> /opt/htmirror/grafana-4.5.2/bin-r-------- 1 root root 0 Nov 17 11:14 environlrwxrwxrwx 1 root root 0 Nov 17 11:14 exe -> /opt/htmirror/grafana-4.5.2/bin/grafana-serverdr-x------ 2 root root 0 Nov 17 11:12 fddr-x------ 2 root root 0 Nov 17 11:14 fdinfo-rw-r--r-- 1 root root 0 Nov 17 11:14 gid_map-r-------- 1 root root 0 Nov 17 11:14 io-r--r--r-- 1 root root 0 Nov 17 11:14 limits-rw-r--r-- 1 root root 0 Nov 17 11:14 loginuiddr-x------ 2 root root 0 Nov 17 11:14 map_files-r--r--r-- 1 root root 0 Nov 17 11:14 maps-rw------- 1 root root 0 Nov 17 11:14 mem-r--r--r-- 1 root root 0 Nov 17 11:14 mountinfo-r--r--r-- 1 root root 0 Nov 17 11:14 mounts-r-------- 1 root root 0 Nov 17 11:14 mountstatsdr-xr-xr-x 6 root root 0 Nov 17 11:14 netdr-x--x--x 2 root root 0 Nov 17 11:14 ns-r--r--r-- 1 root root 0 Nov 17 11:14 numa_maps-rw-r--r-- 1 root root 0 Nov 17 11:14 oom_adj-r--r--r-- 1 root root 0 Nov 17 11:14 oom_score-rw-r--r-- 1 root root 0 Nov 17 11:14 oom_score_adj-r-------- 1 root root 0 Nov 17 11:14 pagemap-r-------- 1 root root 0 Nov 17 11:14 personality-rw-r--r-- 1 root root 0 Nov 17 11:14 projid_maplrwxrwxrwx 1 root root 0 Nov 17 11:14 root -> /-rw-r--r-- 1 root root 0 Nov 17 11:14 sched-r--r--r-- 1 root root 0 Nov 17 11:14 schedstat-r--r--r-- 1 root root 0 Nov 17 11:14 sessionid-rw-r--r-- 1 root root 0 Nov 17 11:14 setgroups-r--r--r-- 1 root root 0 Nov 17 11:14 smaps-r-------- 1 root root 0 Nov 17 11:14 stack-r--r--r-- 1 root root 0 Oct 24 16:43 stat-r--r--r-- 1 root root 0 Oct 26 16:40 statm-r--r--r-- 1 root root 0 Oct 24 16:43 status-r-------- 1 root root 0 Nov 17 11:14 syscalldr-xr-xr-x 73 root root 0 Nov 6 18:50 task-r--r--r-- 1 root root 0 Nov 17 11:14 timers-rw-rw-rw- 1 root root 0 Nov 17 11:14 timerslack_ns-rw-r--r-- 1 root root 0 Nov 17 11:14 uid_map-r--r--r-- 1 root root 0 Nov 17 11:14 wchan