Basic Process Management commands for Linux:

Reading Time: 4 minutes

In this blog we will get to know about Process Management In Linux:

Process management on Linux simply operates i.e continue, stop, or terminate , commands that are already running, just started, or already completed.

A process is a running program. This process is created when a command is about to be executed, so you can call it a running instance of a running program. Process optimization or control is called process management.

There are basically two types of Processes:

  1. FOREGROUND PROCESS:

Such processes are also known as interactive processes. These are processes that the user or programmer must run or start and cannot be initialised by system services. Such a process takes input from the user and returns output. You cannot start a new process directly from the same terminal while these processes are running.

2. BACKGROUND PROCESS:

Such processes are also known as non-interactive processes. These are processes that need to be run or started by the system itself or by the user, but can also be managed by the user. These processes have unique PIDs or processes, if assigned, and can start other processes within the same terminal where they were started.

Let’s watch it Practically:

Example of foreground process:

1. sleep 5

So this command is executed in terminal and after running the above command, you can run another command.

2. Stop the process between runs. To stop the foreground process during execution, press Ctrl + Z to stop it.

sleep 100

Press CTRL + Z while the command is running to stop the command.

3. Now we want to list of jobs that are either running or stopped.

jobs

This command will show the stopped processes in this terminal and also the pending one.

4.  Now I run all the pending and force stopped jobs in the bg i.e background

bg

This command will start the stopped or pending processes in the bg.

5. If we want to get details of a process running in bg :

6. If we want all the pending and force stopped jobs in the fg

fg

This command will start the stopped and pending processes in the fg.

7. To run a process in the background without getting impacted by the closing of the terminal.

While executing this command it will store all the output after execution in nohup.outfile.

8. If we want to run some processes in the bg directly

This command will run the process in the background and display the process id of the particular process.

9. Get the list of all the running processes on your Linux Machine.

top

Here we get all the process that currently running in my system.

10. PS

This command stands for `processstatus`. This is similar to the “Task Manager” that appears on Windows computers when you use Ctrl + Alt + Del. This command is similar to the `top` command, but the information displayed is different.

To check all the process running under the user use this command:

11. Also check process id:

12. DF.

This utility reports the free disk space(Hard Disk) on all the file systems.

13. If you want to display the above information in a readable format, use command .

df -h

14. Free,

This command shows the free and used memory (RAM) on the Linux system.

15. Kill.

This command terminates running processes on a Linux machine.

To use these utilities you need to know the PID (process id) of the process you want to kill:

SUMMARY:

  1. A running program or command sent to a Linux system is called a process.
  2. Processes can run in the foreground or in the background The process priority index is called Nice on Linux.
  3. The default value is 0, which varies between 20 and 19.
  4. The lower the Niceness Index, the higher the priority of this task.

CONCLUSION:

In this blog, we learn about Process Management in linux. It is a fundamental concept we should be knowing if we work on linux. Hope this blog will helpful.

HAPPY LEARNING.

Written by 

Mayuri Dhote is a Software Consultant at Knoldus Software. She has completed her MCA from VIT University. She has very dedicated towards her work. She has always ready to learn new things. Her practice area is Devops. When not working, you will find her writing poems and poetry.

1 thought on “Basic Process Management commands for Linux:6 min read

Comments are closed.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading