Book Image

Troubleshooting Ubuntu Server

By : Skanda Bhargav
Book Image

Troubleshooting Ubuntu Server

By: Skanda Bhargav

Overview of this book

Table of Contents (16 chapters)
Troubleshooting Ubuntu Server
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

The basics of process management


Let's now look at some basic process management commands and tools.

$$ and $PPID

Let's look at some shell variables that carry information about processes. The $$ is a special variable in shell that stores the process ID of the current process. The process ID of its parent is in the $PPID variable. Here's an example to check $$ and $PPID:

Note that you cannot assign values to these special shell variables.

pidof

If you want to know the ID of a process but you have only its name, you can use the command shown in the following screenshot:

Here, you can see we have listed out the process ID for the apache2 process. You can specify any process name and will see the process IDs with the pidof command.

Parent and child

In the previous sections, we saw the terminologies and also brief information on parent process. Essentially, every process is started by its parent; in UNIX, processes follow the parent-child relation. Let's now demonstrate this by calling a new bash from...