Categories: Ubuntu

How to start and kill a process in Ubuntu 20.04 LTS

A process is a series of steps to perform some specific tasks. In terms of computer science, a process is a program undergoing execution. Often Multiple processes run at a time. One process is associated with one program and each process has different components that perform their respective tasks. Different properties are associated with each process. These are:

  • Process Number
  • Process State
  • Process Name
  • Unique Process Number
  • Origin of a process
  • Time, taken by each process

In this article, we will see how to start and kill any process through the command line input. For this particular guide, I am using the Linux distributed system, Ubuntu 20.04 LTS. Follow the guide completely for a thorough understanding.

Prerequisites

  • Ubuntu 20.04 LTS system
  • User with sudo privileges

Starting a process through CLI

To start any process through CLI, you have to follow the below steps:

Open Ubuntu 20.04 LTS Terminal

  • Go to the bottom left of the Desktop and click on the Menu icon.

  • Go to the search bar on the top left.
  • Type “terminal” there and click on the “Terminal”.

  • Clicking on the “Terminal” will show the following display.

Starting a process

  • For this particular, let’s suppose I want to open the process “Firefox”. To open Firefox through command line input, run the following command in the terminal:

$ processname

For this particular article, the process name is "firefox' in the above command. When you run this command, it will open the firefox process in the background just as shown in the below-attached image.

  • You can also check the version of the process opened through CLI. To check the version of “firefox”, run the following command.

$ firefox -v

Running the above will display the version of the firefox process being opened in the background. It will give you the following display:

  • After starting the process, you can also see the full executable file path for the respective process. To do so, use the “which command”:

$ which firefox

It will display the following path concerning my system:

Killing/terminating a process

To kill, terminate, or stop a process through the command-line input, run the following command:

  • Before killing any process, you first need to find its PID known as “Process ID”. Every process has a unique PID number. To find the PID of any process, run the following command:

$ ps

The command will display the PID of all ongoing processes. In this case, we took “firefox” as an example. So, look for it. Running the above command will you the following details

  • Next, you have to kill the process after fetching its PID. For killing a process, run the following command:

$ kill PID

As you can see in the above-attached screenshot, the PID of firefox is "5739". So the command will be:

$ kill 5739

Executing the above command will kill, terminate, or stop the process "firefox" running in the background.

Conclusion

The article will help you understand the concept of process, how to start and terminate the process through command line input in a very initial and easy manner. If you are a beginner and learning things on your own, then this article is highly beneficial for you as it explains the guide in simpler words through easy to grab practical demonstration.

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn

Recent Posts

How to Install Magento 2 on AlmaLinux

Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…

1 year ago

How to Install ISPConfig Hosting Control Panel with Apache Web Server on Ubuntu 24.04

ISPConfig is an open-source control panel that allows users to manage multiple servers from a…

1 year ago

How to Test your Email Server (SMTP) Using the Telnet Command

As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…

1 year ago

Managing Network Interfaces and Settings on Ubuntu 24.04 with nmcli

Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…

2 years ago

Using Restic Backup on Ubuntu 24.04

Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…

2 years ago

Installing phpMyAdmin on Rocky Linux 9 and Securing it with Let’s Encrypt SSL

phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…

2 years ago