An exploration of the /proc directory

in linux •  7 years ago 

The /proc directory is a way to view information on the running processes and the kernel within the file system.

/proc/[pid]/

For each process on the computer, there is a directory containing files with information on it.

/proc/[pid]/cmdline

This is a file that contains the command that started this process.
For example, run ps and get the process id of the shell. Next, run cat /proc/[pid]/cmdline (pid being the shell's process id.) And you would see the command that started the shell (probably bash.)

/proc/[pid]/cwd

This is a symlink to the current working directory of the process
Now, run readlink -f /proc/[pid]/cwd with pid still being the process id for the shell, and you will see the directory you are currently in.

/proc/[pid]/exe

This is a symlink to the original executable
And now, run readlink -f /proc/[pid]/exe and you will get the location of bash (or what ever shell you were using).

/proc/version

This contains information on the current version of Linux and its compiling.

/proc/uptime

This contains how long the kernel has been running for in seconds.

This is just a bit of the information you could get from the /proc directory.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @snewmark! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You got a First Reply

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

Upvote this notification to help all Steemit users. Learn why here!