View a process run path under Linux

Source: Internet
Author: User

Viewing processes under Linux Everyone would have thought of using Ps-ef|grep XXX


But see not the whole path, how to see the whole path?

After each process starts, there is a path to the PID below the/proc

Example: Ps-ef|grep python

Display: Oracle 4431 4366 0 18:56 pts/2 00:00:00 python server.py

4431 is the process number

To/proc/4431, Ls-l will see (Requires root access):

Total dosage 0
-r--r--r--1 Oracle Oinstall 0 December 18:58 cmdline
lrwxrwxrwx 1 Oracle Oinstall 0 December 18:58 CWD--/XXX/ULTSERVER_AA
-R--------1 Oracle oinstall 0 December 18:58 environ
lrwxrwxrwx 1 Oracle oinstall 0 December 18:58 exe--/usr/bin/python2.4
DR-X------2 Oracle Oinstall 0 December 18:58 FD
-R--------1 Oracle Oinstall 0 December 18:58 Maps
-RW-------1 Oracle oinstall 0 December 18:58 Mem
-r--r--r--1 Oracle Oinstall 0 December 18:58 Mounts
lrwxrwxrwx 1 Oracle Oinstall 0 December 18:58 Root
-r--r--r--1 Oracle Oinstall 0 December 18:58 Stat
-r--r--r--1 Oracle Oinstall 0 December 18:58 STATM
-r--r--r--1 Oracle Oinstall 0 December 18:58 Status

Note CWD, which is the path to the process you are looking for.

Transferred from: http://blog.csdn.net/brioxu/article/details/5104736

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.