The Wayback Machine - https://web.archive.org/web/20241006073045/https://www.geeksforgeeks.org/process-management-in-linux/
Open In App

Process Management in Linux

Last Updated : 17 May, 2020
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

A process means program in execution. It generally takes an input, processes it and gives us the appropriate output. Check Introduction to Process Management for more details about a process. There are basically 2 types of processes.

  1. Foreground processes: Such kind of processes are also known as interactive processes. These are the processes which are to be executed or initiated by the user or the programmer, they can not be initialized by system services. Such processes take input from the user and return the output. While these processes are running we can not directly initiate a new process from the same terminal.
  2. Background processes: Such kind of processes are also known as non interactive processes. These are the processes that are to be executed or initiated by the system itself or by users, though they can even be managed by users. These processes have a unique PID or process if assigned to them and we can initiate other processes within the same terminal from which they are initiated.

Practically Managing the Processes

1. Example of foreground process.

sleep 5

Foreground-process-example-sleep

This command will be executed in the terminal and we would be able to execute another command after the execution of the above command.

Note: In this case, the name of the process is sleep 5 but you may change the same as per your need.

2. Stopping a process in between of its execution. To stop a foreground process in between of its execution we may press CTRL+Z to force stop it.

sleep 100

Stopping-a-process-in-between-of-its-execution

Pressing CTRL+Z in between the execution of the command will stop it.

Note: In this case the name of the process is sleep 100 but you may change the same as per your need.

3. To get the list of jobs that are either running or stopped.

jobs

To-get-the-list-of-jobs-which-are-either-running-or-stopped2

It will display the stopped processes in this terminal and even the pending ones.

4. To run all the pending and force stopped jobs in the background.

bg

To-execute-pending-and-force-stopped-jobs-in-the-background1

This will start the stopped and pending processes in the background.

5. To get details of a process running in background.

ps -ef | grep sleep

To-get-details-of-a-process-running-in-background2

Note: In this case the name of the process is sleep 100 but you may change the same as per your need.

6. To run all the pending and force stopped jobs in the foreground.

fg

To-run-all-the-pending-and-force-stopped-jobs-in-the-foreground

This will start the stopped and pending processes in the foreground.

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

nohup sleep 100 &

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

While executing, it will even store all the output after execution in nohup.out file.

Note: In this case, the process is sleep 100, you may modify it as per your need.

8. To run some processes in the background directly.

sleep 100&

To-run-some-processes-in-the-background-directly2

This will run the process in the background and will display the process id of the process.
Note:- In this case, the process is sleep 100, you may modify it as per your need.

9. To run processes with priority.

nice -n 5 sleep 100 

To-run-processes-with-priority1

The top priority is -20 but as it may affect the system processes so we have used the priority 5.

Note: In this case, the process is sleep 100, you may modify it as per your need.

10. To get the list of all the running processes on your Linux machine.

top

To-get-the-list-of-all-the-running-processes-on-your-Linux-machine

This will display all the processes that are currently running in your system.


Previous Article
Next Article

Similar Reads

Linux Process Management Command Cheat Sheet
On Linux computers there are special commands to control the programs that are running. These commands are called process management commands. With the help of process management commands you can look at the list of the programs that are currently running on your computer. You can also start new programs and run them and stop programs that are alre
6 min read
File Management in Linux
In Linux, most of the operations are performed on files. And to handle these files Linux has directories also known as folders which are maintained in a tree-like structure. Though, these directories are also a type of file themselves. Linux has 3 types of files: Regular Files: It is the common file type in Linux. it includes files like - text file
4 min read
What is init.d in Linux Service Management?
In Linux there are several services that can be started and stopped manually in the system, some of their services are ssh, HTTP, tor, apache, etc. To start and run these services we used to simply type service "service name" start/stop/status/restart Example: service ssh start And to check if this service is running we type the command service ssh
2 min read
Group Management in Linux
There are 2 categories of groups in the Linux operating system i.e. Primary and Secondary groups. The Primary Group is a group that is automatically generated while creating a user with a unique user ID simultaneously a group with an ID the same as the user ID is created and the user gets added to the group and becomes the first and only member of
4 min read
Kali Linux - File Management
In Kali Linux, most of the operations are performed on files. And to handle these files Kali Linux has directories also known as folders which are maintained in a tree-like structure. Though, these directories are also a type of file themselves. Kali Linux has 3 basic types of files: Regular Files: It is the common file type in Linux. it includes f
4 min read
YUM Commands for Linux Package Management
If you are a Linux user or system administrator, chances are you've come across YUM (Yellowdog Updater, Modified) at some point in your journey. YUM is a powerful package management tool that simplifies the process of installing, updating, and managing software on Red Hat-based Linux distributions like CentOS and Fedora. In this article, we will de
4 min read
Debian Software Package Management(dpkg) in Linux
In Linux, there are a lot of different distributions and each of these distributions has a different package type.  For example .rpm or Red hat Package Manager is used as the package in the Linux distribution. A package is the compressed version of the software. In this article, we will go through the Debian package which is used by Ubuntu. D packa
4 min read
Privileged access management (PAM) for linux and unix
In this article, we will learn about the Privileged Access Management (PAM) which is pivotal in safeguarding critical systems and data from unauthorized access. PAM involves the management and governance of privileged accounts and access. Let's dive deep into this article. What is Privileged Access Management (PAM)?Privileged Access Management (PAM
6 min read
How I use Cockpit for my Home's Linux Server Management
Cockpit is a free, open-source, and easy-to-use yet powerful remote manager for Linux servers that allows system administrators to quickly monitor or manage system resources, logs, storage, network, background services, and much more from one central dashboard. You can also access the Linux shell of different Linux servers from the Cockpit web inte
6 min read
Command-Line Tools and Utilities For Network Management in Linux
If you are thinking of becoming a system administrator, or you are already a system admin, then this article is for you. As a system admin, your daily routine will include configuring, maintaining, troubleshooting, monitoring, securing networks, and managing servers within data centers. Network configuration and troubleshooting are some important t
8 min read
User Management in Linux
A user is an entity, in a Linux operating system, that can manipulate files and perform several other operations. Each user is assigned an ID that is unique for each user in the operating system. In this post, we will learn about users and commands which are used to get information about the users. After installation of the operating system, the ID
5 min read
Process Control Commands in Unix/Linux
Process control commands in Unix are: bg - put suspended process into background fg - bring process into foreground jobs - list processes bg Command : bg is a process control command that resumes suspended process while keeping them running in the background. User can run a job in the background by adding a "&" symbol at the end of the command.
3 min read
Priority of process in Linux | nice value
The running instance of program is process, and each process needs space in RAM and CPU time to be executed, each process has its priority in which it is executed. Now observe the below image and see column NI top Output: The column NI represents nice value of a process. It's value ranges from -20 to 20(on most unix like operating systems). -20 20
2 min read
Getting System and Process Information Using C Programming and Shell in Linux
Whenever you start a new process in Linux it creates a file in /proc/ folder with the same name as that of the process id of the process. In that folder, there is a file named "status" which has all the details of the process. We can get those Process Information Through shell as follows: cat /proc/1/status As can be seen, it displays most of the i
2 min read
Installing atop Tool To Monitor the System Process in Linux
atop is an ASCII full-screen interactive performance monitor which is kind of similar to the top command to view the load over a Linux system. The job of the most critical hardware resources (from a performance point of view) at the system level, i.e. CPU, memory, disk, and network can be seen. atop enable us to identify which processes are actuall
7 min read
How to Install and Use Scout_Realtime to Monitor Server and Process Metrics in Linux?
There are numerous free tools on Linux that are used to monitor the Linux system including hardware and software. We all may have already come across some command-line Linux performance monitoring tools such as top, htop, atop, etc. Alike that we come across another tool called Scout Realtime tool which is used for server monitoring, that you can s
2 min read
limits.conf File To Limit Users, Process In Linux With Examples
Linux gives full control over the system. In this article, we are going to learn about the file limits.conf. limits.conf is a configuration that is used to limit the resources to the user, groups. Now let's understand the file structure of limits.conf and how can we use the limits.conf to limit resources to the user. Before moving further, note tha
6 min read
Easy way to kill process using Fkill in Linux
fkill-cli is a command-line-based tool to kill processes interactively. Fkill is developed using Nodejs. It can run on different operating systems like macOS, Linux, and Windows. To kill the process using fkill we just have to mention the process name or the process PID. Fkill can also be used to kill port. Installation of fkill on Different OS. No
3 min read
GRecon - Automates the process of Google Dorking on Linux
Google Dorking is the process of searching the publicly available information on the internet in a more innovative way. The advanced query is fired to get the exact results of our doubt. As Google has the collection of massive data, sometimes we didn't get the results we want, So in this case, we can use this Google Dorking process. GRecon tool is
3 min read
Get Process ID of Linux Foreground and Background Processes
The PID (process identification number) is a serial number (starting from 1) given by the operating system to uniquely identify the process. Every process started either by the operating system or by the user gets a PID in order of their invocation by the kernel. If we start the same process several times, it will be assigned different PID numbers
4 min read
How to Audit Linux Process Using ‘autrace’ on CentOS/RHEL
Autrace is a command line tool that is used for the purpose of auditing processes on Linux. The audit rules which are created by autrace are stored in the /var/www/audit/audit.log file. Before autrace can work perfectly all the previous audit logs must be deleted. The syntax of autrace is given below: Syntax: autrace -r program program-args Note: H
3 min read
Batch Script - Process in Linux
A Batch Script is basically a script having commands which execute sequentially. It helps users to perform repetitive tasks without human or user intervention or input. To automate some tasks like loading processes, and killing processes. Now in this article, we will write a batch script to view all the processes that are running, once getting all
2 min read
How to Prevent a Background Process From Being Stopped after Closing SSH client in Linux
What is Background Process? A Background Process is an ongoing process running independently, and that is not visible to the users as it runs without any user interaction after the terminal has been closed. Some of the well-known examples of Background processes are the web servers like Nginx and Apache. The Nginx discovers the file and sends it to
4 min read
Boot Process with Systemd in Linux
Systemd is a Linux system and service manager that is responsible for controlling the boot process of a Linux system. The systemd boot process consists of several stages, each of which performs a specific task that is necessary for the successful initialization of the system. Understanding Systemd : One of the key features of systemd is their abili
7 min read
How to Kill a Process in Linux | Kill Command
kill command in Linux (located in /bin/kill), is a built-in command which is used to terminate processes manually. kill command sends a signal to a process that terminates the process. If the user doesn't specify any signal that is to be sent along with the kill command, then a default TERM signal is sent that terminates the process. Basic Syntax o
6 min read
Exit status of a child process in Linux
It is known that fork() system call is used to create a new process which becomes child of the caller process. Upon exit, the child leaves an exit status that should be returned to the parent. So, when the child finishes it becomes a zombie.Whenever the child exits or stops, the parent is sent a SIGCHLD signal. The parent can use the system call wa
3 min read
Difference Between Arch Linux and Kali Linux
Arch Linux is an open-source Linux-based Operating System that is freely available for use. It belongs to the Pacman-based Linux family. It is a light weighted OS for daily use and could even be used by professionals. It was first released in March 2002. It is a beginner-friendly Linux Operating System. Features of Arch Linux: Minimalist approach:
4 min read
Neofetch In Linux – Snap cool screenshots of your Linux
Neofetch is a fancy, highly customizable, and aesthetic command-line system information screenshot utility tool. Written in the Bash scripting language, it works inside a terminal window, on triggering up the command it by default displays the operating system, software, and hardware of your system on the right side of the column alongside an ASCII
4 min read
Exodus - Copy Linux Binaries From One Linux System
Exodus is an easy-to-implement program, that is used for bundling dependencies, and also helps to effectively copy Linux ELF binaries from one to another machine securely, and this is very handy when you don't have root access, also if there are issues in the availability of the packages in the Linux distribution, Commonly Server oriented distribut
3 min read
Basic CentOS Linux Commands in linux
CentOS is a free and open-source operating system that aims to provide a stable reliable, and community-supported platform for servers and other enterprise applications. In this article, we will be covering CentOS Linux basics commands and functions of CentOS and also we will look into the advanced commands. These CentOS commands allow you to manag
3 min read
Article Tags :