Kill Linux Processes the Easy Way with Fkill

fkill turorial
(Image credit: Tom's Hardware)

While Linux distributions don’t suffer the ignominy of a blue screen of death, running processes (aka programs)  do become unresponsive sometimes. If you run a web browser, media player, ebook reader, etc. on your Linux distribution, each of these is a different process, with a unique process ID and, traditionally, you need to issue a couple of different commands to find this ID and stop it. 

Released under the MIT License, fkill is a cross-platform utility that can be used to interactively kill processes with ease. With fkill, we can scroll through a list of running processes and kill any of them by pressing the Enter key. We can also search through the processes by typing the name of commands / processes  into the terminal and the output will be filtered to show any matching entries. This is a world away from how commands such as top are used to list processes via grep and a separate command is then used to kill the process using its PID.

Fkill is not available in Linux distributions out of the box. It’s also not available in the software repositories of most Linux distributions. However, its only dependency is the Node.js runtime environment, which you can easily install from the software repository on your distribution. You’ll also need the npm package manager, which too can be installed using the package management tool on your distribution.

How to Install Fkill in Linux

The following instructions work in Ubuntu or Debian and probably several other flavors as well.

1. Open a terminal window and update the list of repositories

$ sudo apt update

2. Install Node.js and Npm Package Manager

sudo apt install nodejs npm

3. Install fkill.

npm install --global fkill-cli

How to Use Fkill to Kill Tasks in Linux 

Terminating a program with fkill is as easy as typing it at the command prompt, with no command line arguments required. Here are three main ways to use it.

1. Type fkill and navigate the menu. If you just launch fkill, you’ll be shown a scrolling list of all current processes. Select the process you want to kill and hit Enter

(Image credit: Tom's Hardware)

You can use the arrows to navigate through the list or start typing the name of the process you are looking for (ex: “fire” for firefox) and you’ll see a list of matching processes appear.  

(Image credit: Tom's Hardware)

2. Enter fkill [process name]. For example, you’d type fkill firefox to kill firefox. 

(Image credit: Tom's Hardware)

3. Enter fkill [process ID]. If you know the process ID, you can kill it directly. 

(Image credit: Tom's Hardware)

Unlike alternative commands such as kill, which supports sending many different signals to the process, Fkill can only be used to kill the process so it works just like kill -9. 

Shashank Sharma
Freelance Writer

Shashank Sharma is a freelance writer for Tom’s Hardware US, where he writes about his triumphs and joys of working with the Linux CLI.

  • domih
    That's one way. Alternatively many built-in solutions (no need for node.js) exist, including GUI-based ones:

    https://www.linuxsecrets.com/1492-killing-a-unresponsive-process-or-application-on-linux
    Ubuntu System Monitor (GUI) or equivalent in other distributions and pkill (console) are pretty good in terms of ease of use and usually present by default in many distributions.
    Reply
  • jkflipflop98
    laughs in Task Manager
    Reply
  • jaclu
    htop does the same and can be installed on MacOS
    Reply
  • unis_torvalds
    jkflipflop98 said:
    laughs in Task Manager
    Also possible to use GUI task managers in any distro for those who are afraid of the command line.
    I think the article was specifically only talking about CLI programs.
    Reply
  • unis_torvalds
    Shout out XKILL for those on default X (non Wayland) sessions!
    Reply