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.