首页 > 代码库 > 如何通过pid快速找出进程的路径
如何通过pid快速找出进程的路径
[carlton@oc3408554812 Desktop]$ top
top - 09:35:06 up 32 min, 2 users, load average: 1.49, 1.56, 1.32
Tasks: 290 total, 1 running, 287 sleeping, 0 stopped, 2 zombie
Cpu(s): 9.9%us, 4.7%sy, 0.0%ni, 80.2%id, 5.2%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 7885644k total, 7683776k used, 201868k free, 25272k buffers
Swap: 8388604k total, 34516k used, 8354088k free, 1894224k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7489 qemu 20 0 6763m 4.0g 6200 S 17.7 53.1 5:01.19 qemu-kvm
5123 carlton 20 0 1438m 337m 49m S 4.4 4.4 5:31.39 firefox
3 root RT 0 0 0 0 S 3.0 0.0 0:00.70 migration/0
2374 root 20 0 0 0 0 S 3.0 0.0 0:01.73 kondemand/2
3932 root 20 0 521m 18m 5040 S 3.0 0.2 0:49.29 BESClient
8731 carlton 20 0 15164 1272 832 R 3.0 0.0 0:00.11 top
7 root RT 0 0 0 0 S 1.5 0.0 0:00.59 migration/1
2372 root 20 0 0 0 0 S 1.5 0.0 0:02.07 kondemand/0
2373 root 20 0 0 0 0 S 1.5 0.0 0:02.36 kondemand/1
4103 root 20 0 191m 28m 13m S 1.5 0.4 2:18.99 Xorg
5698 carlton 20 0 127m 43m 18m S 1.5 0.6 0:01.72 taskldr
1 root 20 0 19372 1448 1120 S 0.0 0.0 0:01.19 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kthreadd
4 root 20 0 0 0 0 S 0.0 0.0 0:00.06 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 stopper/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 stopper/1
[carlton@oc3408554812 Desktop]$ cd /proc/5123
[carlton@oc3408554812 5123]$ ls
attr coredump_filter io mountstats pagemap stack
autogroup cpuset limits net personality stat
auxv cwd loginuid ns root statm
cgroup environ maps numa_maps sched status
clear_refs exe mem oom_adj schedstat syscall
cmdline fd mountinfo oom_score sessionid task
comm fdinfo mounts oom_score_adj smaps wchan
[carlton@oc3408554812 5123]$ ls -l exe
lrwxrwxrwx. 1 carlton carlton 0 Sep 19 09:24 exe -> /usr/lib64/firefox/firefox
如何通过pid快速找出进程的路径