In linux, view the complete process path. when we view the processes that are running in the system, sometimes we want to view the detailed information of the following processes, including the absolute path, at this time, the ps deficiency is revealed, and the powerful top can only view the process name. What should I do at this time... information & view the complete process path in linux when we view the processes that are running in the system, sometimes we want to view the detailed information of the following processes, including the absolute path, at this time, the ps deficiency is revealed, and the powerful top can only view the process name. What should we do at this time? Personally, when a process is started in linux, an ID will be assigned to the process, that is, our PID. at the same time, the system will create a folder under/proc named after PID, in this folder, there will be information about our processes, including a file named exe, which we want, like the exe file under win, it is a link to the original program, so when we use ls-l, we can get our complete path! Www.2cto.com $ top-11:37:41 up 51 min, 4 users, load average: 0.62, 0.80, 0.77 Tasks: 167 total, 1 running, 166 sleeping, 0 stopped, 0 zombie Cpu (s): 8.6% us, 2.3% sy, 0.0% ni, 87.0% id, 2.1% wa, 0.0% hi, 0.0% si, 0.0% st Mem: 2026800 k total, 1948128 k used, 78672 k free, 565720 k buffers Swap: 261112 k total, 0 k used, 261112 k free, 922732 k cached pid user pr ni virt res shr s % CPU % mem time + COMMAND 17 09 ubuntu 20 0 408 m 145 m 32 m S 10 7.4. 69 firefox-bin 1049 root 20 0 94368 34 m 13 m S 5 1.7. 41 Xorg 1747 ubuntu 20 0 228 m 68 m 19 m S 5 3.5. 79 plugin-containe 1536 ubuntu 20 0 85264 28 m 9184 S 2 1.4. 85 compiz 1640 ubuntu 20 0 59260 18 m 13 m S 1 1.0. 05 gnome-terminal 9 root 20 0 0 0 S 0 0.0. 03 events/0 1051 mysql 20 0 142 m 18 m 5856 S 0 0.9. 90 mysqld 3101 ubuntu 20 0 2548 1224 924 R 0 0.1. 03 top 1 root 20 0 2780 1704 1228 S 0 0.1. 37 init 2 root 20 0 0 0 S 0 0.0. 00 kthreadd 3 root RT 0 0 0 S 0 0.0 0 00. 00 migration/0 $ cd/proc/1709 // proc/1709 $ ls attr cpuset io mountinfo pagemap smaps task auxv cwd latency mounts personality stack wchan cgroup environ limits mountstats root stat unzip exe loginuid net sched statm using line fd maps oom_ad J schedstat status coredump_filter fdinfo mem oom_score sessionid syscall/proc/1709 $ ls-l exe lrwxrwxrwx 1 ubuntu 0 exe->/usr/lib/firefox-3.6.18/firefox-bin unzip cwd the symbolic link is the running directory of process 22401; the exe symbolic connection is the absolute path of the execution program, and the cmdline is the command line command entered when the program is running. This example is :. /Cbscpu records the cpu on which the process may run; the virtual cpu information is displayed. environ Records the environment variable fd when the process is running. the fd directory contains the symbolic connection of the files opened or used by the process... You can directly access the process running Directory through cwd. by viewing the relevant information, you can locate the port number corresponding to this directory and locate the application to use this service program. In this way, the path of the Linux process file is obtained.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service