How to obtain the path of the linux Process Execution File

Source: Internet
Author: User
Article Title: how to obtain the path of the linux Process Execution file. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Enter the/proc directory

Ps: view all processes that match./cmd and find the corresponding process number.

Run ll command: ll process number

An example is shown as follows:

[Root @ Cluster1 proc] # All 22401

Total 0

-R -- 1 zhouys 0 Dec 11 :10 running line

-R -- 1 zhouys 0 Dec 11 cpu

Lrwxrwxrwx 1 zhouys 0 Dec 11 :10 cwd->/home/zhouys/sbs/bin

-R -------- 1 zhouys 0 Dec 11 :10 environ

Lrwxrwxrwx 1 zhouys 0 Dec 11 :10 exe->/home/zhouys/sbs/bin/cbs (deleted)

Dr-x ------ 2 zhouys 0 Dec 11 :10 fd

-R -------- 1 zhouys 0 Dec 11 11:10 maps

-Rw ------- 1 zhouys 0 Dec 11 :10 mem

-R -- 1 zhouys 0 Dec 11 :10 mounts

Lrwxrwxrwx 1 zhouys 0 Dec 11 :10 root->/

-R -- 1 zhouys 0 Dec 11 :10 stat

-R -- 1 zhouys 0 Dec 11 :10 statm

-R -- 1 zhouys 0 Dec 11 :10 status

The files under the process number directory in the/proc file system mirror the current running information of the process,

We can see that:

The cwd symbolic link is the running directory of process 22401;

The exe symbolic connection is the absolute path of the execution program;

Cmdline is the command line command entered when the program is running. In this example:./cbs

The cpu records the cpu on which the process may run. The virtual cpu information is displayed.

Environ records the environment variables when the process is running.

The fd directory is 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

Find the application to use this service program.

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.