This article is a mirror article of machine translation, please click here to jump to the original article.

View: 13721|Reply: 0

[linux] CentOS looks at the directory location where the program is running

[Copy link]
Posted on 11/9/2016 1:07:12 PM | | | |


Let's take the memcached process as an example,

We don't run with root privileges.

Task: View processes running non-root
When Linux starts a process, the system will create a folder named PID under /proc, under which there will be information about our process, including a file called exe that records the absolute path, which can be viewed through the ll or ls –l command.

ll /proc/PID


dr-xr-xr-x 2 www  www  0 Nov  9 12:42 attr
-rw-r--r-- 1 root root 0 Nov  9 12:42 autogroup
-r-------- 1 root root 0 Nov  9 12:42 auxv
-r--r--r-- 1 root root 0 Nov  9 12:42 cgroup
--w------- 1 root root 0 Nov  9 12:42 clear_refs
-r--r--r-- 1 root root 0 Oct 26 16:15 cmdline
-rw-r--r-- 1 root root 0 Nov  9 12:42 comm
-rw-r--r-- 1 root root 0 Nov  9 12:42 coredump_filter
-r--r--r-- 1 root root 0 Nov  9 12:42 cpuset
lrwxrwxrwx 1 root root 0 Oct 30 12:58 cwd -> /
-r-------- 1 root root 0 Nov  9 12:42 environ
lrwxrwxrwx 1 root root 0 Oct 26 16:15 exe -> /alidata/server/memcached/bin/memcached
dr-x------ 2 root root 0 Nov  9 12:42 fd
dr-x------ 2 root root 0 Nov  9 12:42 fdinfo
-r-------- 1 root root 0 Nov  9 12:42 io
-rw------- 1 root root 0 Nov  9 12:42 limits
-rw-r--r-- 1 root root 0 Nov  9 12:42 loginuid
-r--r--r-- 1 root root 0 Nov  9 12:42 maps
-rw------- 1 root root 0 Nov  9 12:42 mem
-r--r--r-- 1 root root 0 Nov  9 12:42 mountinfo
-r--r--r-- 1 root root 0 Nov  9 12:42 mounts
-r-------- 1 root root 0 Nov  9 12:42 mountstats
dr-xr-xr-x 4 www  www  0 Nov  9 12:42 net
dr-x--x--x 2 root root 0 Nov  9 12:42 ns
-r--r--r-- 1 root root 0 Nov  9 12:42 numa_maps
-rw-r--r-- 1 root root 0 Nov  9 12:42 oom_adj
-r--r--r-- 1 root root 0 Nov  9 12:42 oom_score
-rw-r--r-- 1 root root 0 Nov  9 12:42 oom_score_adj
-r--r--r-- 1 root root 0 Nov  9 12:42 pagemap
-r--r--r-- 1 root root 0 Nov  9 12:42 personality
lrwxrwxrwx 1 root root 0 Nov  9 12:42 root -> /
-rw-r--r-- 1 root root 0 Nov  9 12:42 sched
-r--r--r-- 1 root root 0 Nov  9 12:42 schedstat
-r--r--r-- 1 root root 0 Nov  9 12:42 sessionid
-r--r--r-- 1 root root 0 Nov  9 12:42 smaps
-r--r--r-- 1 root root 0 Nov  9 12:42 stack
-r--r--r-- 1 root root 0 Oct 26 16:15 stat
-r--r--r-- 1 root root 0 Nov  9 12:42 statm
-r--r--r-- 1 root root 0 Oct 26 16:15 status
-r--r--r-- 1 root root 0 Nov  9 12:42 syscall
dr-xr-xr-x 8 www  www  0 Nov  9 12:42 task
-r--r--r-- 1 root root 0 Nov  9 12:42 wchan






Previous:Creating mailbox file: File exists
Next:Linux under memcached self-boot configuration
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com