Process management
Processes are used by the Linux kernel, started by a user, or created by other processes. All processes are child processes of process number one, which will be covered in the next chapter. In this section, we learn to identify processes and how to send a signal to a process.
View processes
If you start a program, a process ID (PID) is assigned to the process and a corresponding directory is created in /proc
.
In Bash, you can find the PID of the current shell with the command:
echo $$
You can also find the PID of the parent shell:
echo $PPID
To find the PID of a program on your filesystem, the utility pidof
is available, for instance:
pidof ssh
If you want to use pidof
to find running scripts, including the PID of the shell that is used by a script, you have to add the -s
parameter.
Let's have a look into the proc
directory of the current shell:

You can see all the properties of this process. To name a few:
cmdline
: The command that is executed to create this processenviron
: The...