Quick Links

Windows has Ctrl+Alt+Delete and Macs have Command+Option+Escape to force frozen applications to close. Linux has its own ways of "killing" those misbehaving processes, whether they're graphical windows or background processes.

The exact graphical tools you can use will depend on your desktop environment, as each desktop environment brings different tools to the table. But most of them are pretty similar.

From a Graphical Desktop

Modern Linux desktops deal with this fairly well, and it can be surprisingly automatic. If an application isn't responding, a desktop with a compositiong manager will often gray the entire window out to show it isn't responding.

Click the X button on the window's titlebar and the window manager will often inform you that the window isn't responding. You can either give it some time to respond or click an option like "Force Quit" to foricbly close the application.

On Linux, the window manager that paints the title bars is separate from the application itself, so it usually responds even if the window won't. Some windows do paint their own interfaces, though, so this may not always work.

The "xkill" application can help you quickly kill any graphical window on your desktop.

Depending on your desktop environment and its configuration, you may be able to activate this shortcut by pressing Ctrl+Alt+Esc. You could also just run the xkill command -- you could open a Terminal window, type xkill without the quotes, and press Enter. Or, you could press a shortcut like Alt+F2, which opens the "Run Command" dialog on Ubuntu's Unity desktop and many others. Type xkill into the dialog and press Enter.

Your cursor will change to an X. Click a window and the xkill utility will determine what process is associated with that window, and then immediately kill that process. The window will instantly vanish and close.

Your Linux desktop probably has a tool that works similarly to the Task Manager on Windows, too. On Ubuntu's Unity desktop, GNOME, and other GNOME-based desktops, this is the System Monitor utility. Open the System Monitor utility to see a list of running proesses -- including background ones. You can also forcibly kill processes from here if they're misbehaving.

From the Terminal

Related: How to Manage Processes from the Linux Terminal: 10 Commands You Need to Know

Let's say you want to do this all from the terminal instead. We covered a lot of the utilities you can use for this when we looked at commands for managing processes on Linux.

Let's say Firefox is running in the background and we want to kill it from the terminal. The standard kill command takes a process ID number, so you'll need to find it first.

For example, you could run a command like:

ps aux | grep firefox

Which would list all processes and pipe that list to the grep command, which will filter it and print only lines containing Firefox. (The second line you'll see is the grep process itself.) You can also get the process ID from the top command and many other places.

Take the process ID number from the Firefox process -- just to the right of the username -- and provide it to the kill command. That is, run the command like so:

kill ####

If the process is running as another user, you'll need to become the root user first -- or at least run the kill command with the sudo command, like so:

sudo kill ####

That's a basic method, but it isn't quite the fastest. The pgrep and pkill commands help streamline this. For example, run "pgrep firefox" to see the process ID of the running Firefox process. You could then feed that number to the kill command.

Or, skip all that and run "pkill firefox" to kill the Firefox process without knowing its number. pkill performs some basic pattern-matching -- it'll try to find processes with names containing firefox.

The killall command is like pkill, but a bit more precise. It'll kill all running processes with a specific name. So running "killall firefox" will kill all running processes named "firefox," but not any processes that just have firefox in their names.


These are far from the only commands included on Linux for managing processes. If you're using some type of server administration software, it may also have helpful ways to kill and restart processes.

System services work different from processes -- you'll need to use specific commands to bring down, restart, or bring up services. Those specific commands can be different on different Linux distributions.

Image Credit: Lee on Flickr

Linux Commands

Files

tar · pv · cat · tac · chmod · grep ·  diff · sed · ar · man · pushd · popd · fsck · testdisk · seq · fd · pandoc · cd · $PATH · awk · join · jq · fold · uniq · journalctl · tail · stat · ls · fstab · echo · less · chgrp · chown · rev · look · strings · type · rename · zip · unzip · mount · umount · install · fdisk · mkfs · rm · rmdir · rsync · df · gpg · vi · nano · mkdir · du · ln · patch · convert · rclone · shred · srm · scp · gzip · chattr · cut · find · umask · wc · tr

Processes

alias · screen · top · nice · renice · progress · strace · systemd · tmux · chsh · history · at · batch · free · which · dmesg · chfn · usermod · ps · chroot · xargs · tty · pinky · lsof · vmstat · timeout · wall · yes · kill · sleep · sudo · su · time · groupadd · usermod · groups · lshw · shutdown · reboot · halt · poweroff · passwd · lscpu · crontab · date · bg · fg · pidof · nohup · pmap

Networking

netstat · ping · traceroute · ip · ss · whois · fail2ban · bmon · dig · finger · nmap · ftp · curl · wget · who · whoami · w · iptables · ssh-keygen · ufw · arping · firewalld

RELATED: Best Linux Laptops for Developers and Enthusiasts