Skip to Content
Linux Shell Scripting Cookbook - Third Edition
book

Linux Shell Scripting Cookbook - Third Edition

by Clif Flynt, Sarath Lakshman, Shantanu Tushar
May 2017
Beginner
552 pages
28h 47m
English
Packt Publishing
Content preview from Linux Shell Scripting Cookbook - Third Edition

How to do it...

The /proc directory contains several files and directories. You can view most files in /proc and their subdirectories with cat, less, or more. They are displayed as plain text.

Every process running on a system has a directory in /proc, named according to the process's PID.

Suppose Bash is running with PID 4295 (pgrep bash); in this case, /proc/4295 will exist. This folder will contain information about the process. The files under /proc/PID include:

  • environ: This contains the environment variables associated with the process. cat /proc/4295/environ will display the environment variables passed to the process 4295.
  • cwd: This is a symlink to the process's working directory.
  • exe: This is a symlink to the process's executable: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux Shell Scripting - Second Edition

Mastering Linux Shell Scripting - Second Edition

Mokhtar Ebrahim, Andrew Mallett

Publisher Resources

ISBN: 9781785881985