Linux operating systems have a large number of processes that are created in order to optimize and allow all services to function correctly, but in some situations we can find that various processes can affect the overall performance of the system so we must proceed to "kill" these processes..
For Linux environments, we have a useful command called "fkill" and through this tutorial we will learn what it is and how to use that command in Linux.
What is fkill
Fkill-cli is a free open-source and cross-platform command line tool which has been designed to interactively kill every process that affects all tasks in Linux and has been developed using Nodejs.
Fkill works with full compatibility on macOS, Linux, and Windows operating systems..
1. Install fkill command on Linux
To start this process, we will execute one of the following commands.
Step 1
To install Nodejs and NPM on Debian / Ubuntu systems we have one of the following options:
Step 2
In this case we will install Node.js 10 so we first execute the following:
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
Step 3
Then we execute:
sudo apt install -y nodejs
Step 4
In the case of having CentOS or RedHat we will execute the following:
Step 5
Once the Nodejs and NPM packages have been installed, it will be time to install the fkill-cli package using the npm command with the -g option, which gives us the option to install it globally:
sudo npm install -g fkill-cli
Step 6
When this ends we will see the following:
2. Use fkill command on Linux
Step 1
When the process has installed fkill-cli on Linux, we can use the fkill command in order to start it in interactive mode by executing it without any arguments.
fkill
Step 2
With the fkill command it is possible to indicate a PID or process name from the command line, this process name is not case sensitive, for example:
fkill 1458 fkill Firefox
Step 3
If we want to kill a port, we must add two points like this:
fkill: 19999
Step 4
It is possible to use the “-f†indicator to force an operation and “-v†gives us the option to visualize the process arguments:
fkill -f 1458 fkill -v apache
Step 5
To access the help of fkill we run:
fkill –help
As we can see, fkill is a simple command that gives us the option to completely eliminate processes in Linux.