How to Identifying and managing Linux processes.

A process is a program in execution. A process is a running instance of a program. It provides the information about running application made up of data read from files and other programs or input from a system user.

There are two types of Processes.

  • Foreground processes – A user connected to the system to start processes. The application or service hasn’t started automatically & need input from the user.
  • Background processes –The application or service automatically runs in the background and do not need user input.

 Daemons: It is a background processes that start at system startup and keep running continue as a service and they don’t stop.

init Process

It is the parent of all processes on the system, it’s a first program that execute at startup. It manage all the  processes on the system.

pidof systemd

Find the process ID and parent process ID of the current shell.

echo $$
or
echo $PPID

Here is the command output.

Fig 1

List Active Processes.

  • ps command: It shows information about a selection of the active processes on the system.
ps 
ps -e | head 

Here is the command output.

Fig 2

Detailed list of processes.

ps aux

a : all users.

u : shows the user/owner.

x : processes not executed in the terminal.

  • top command: Its a System Monitoring Tool.

top 

Here is the command output.

Fig. 3

  • glances command: It is also a system monitoring Tool.
glances

Here is the command output.

Fig. 4

List executable path.

echo $PATH

Here is the command output.

 /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

Stopping/Kill the process.

List running process.

ps -all

Stop the process.

kill
or
kill pid
or
kill process name

Control Processes

  • In Linux,we have multiple commands for controlling processes such as kill, pkill, pgrep and killall.
pgrep -u user-name top
kill PID

Here is the command output.

Fig. 6

List background jobs.

bg

List Process IDs

pgrep process-name

 

 

Leave a Reply