Kill Programs and Check System Information in Linux

 
Oh no, something seems to be going wrong with your computer! On Windows, you bring up the task manager using Ctrl + Alt + Delete to confirm your suspicions. Then you use close whichever program is running amok.
But now you’re using Linux, and that keyboard shortcut isn’t doing what you expected. Things are different in open source penguin land. But don’t worry, there are many ways to monitor your system and close renegade programs. Whether you prefer something like the Windows task manager or rather dive straight into the command line, there’s an option for you.

Graphical Applications

This software most resembles the Windows task manager. The functionality isn’t a direct match, as the two systems don’t handle tasks in the same way. Nonetheless, you should find the experience familiar.
Linux has numerous desktop environments, and many ship with their own option. Here are three of the major ones.

1. GNOME System Monitor

LinuxTaskManager-GNOME-System-Monitor
GNOME’s default system monitor application keeps the focus on processes, resources, and file systems. The first tab shows you which processes are running, under which user, the ID number, and the strain on your PC. When you select one, an End Process button appears that can force close apps. This doesn’t always work. In those instances, you need to try some of the commands explained later on.
 
The second tab offers a live view of the workload on each of your CPU cores, how much RAM or swap you’re consuming, and the amount of activity on your network. The third tab is for tracking your storage. Here you can see how much data occupies each of your partitions.

2. KDE System Monitor

LinuxTaskManager-KDE-System-Monitor
The KDE System Monitor, also known as KSysGuard, has even fewer tabs. These are Process Table and System Load. The first shows you processes and memory usage. You can close unresponsive ones by right-clicking and selecting End Process.
The second tab shows a live view of your CPU load, memory usage, and network activity. It’s almost identical to the Resources tab in the GNOME System Monitor.
As you would expect from KDE, you can customize aspects to suit your needs. There’s the option to create new tabs showing information such as partition usage and log files.
LinuxTaskManager-KDE-System-Monitor-New-Tab

3. XFCE Task Manager

The lightweight XFCE desktop’s task manager does away with the standard tabbed interface. Instead you get a graphical view of CPU and memory load with a list of processes underneath.
LinuxTaskManager-XFCE-Task-Manager
Unlike the default GNOME and KDE applications, you can deal with slow processes in multiple ways. Right click and select Stop, Terminate, or Kill.

Pull Up System Monitor Using Ctrl + Alt + Delete

Under Linux, Ctrl + Alt + Delete usually doesn’t do what you may expect it to. Pressing those hotkeys bring up the log out menu, from which you can restart or power down. It’s an alternative to pressing the power key.
Changing this is simple. Under GNOME, for example, go to Settings > Keyboard.
Select the Shortcuts tab. Then look for Custom Shortcuts in the sidebar and click the + button. Enter a name for the shortcut and the command used to launch your task manager. For the GNOME System Monitor, type gnome-system-monitor.
LinuxTaskManager-Custom-Shortcuts
After you’re done, you can select this item in the list of custom shortcuts. Then enter a keyboard binding by holding down the desired keys. In this case, those would be ctrl + alt + delete.
A notification will ask if you want to replace the previous function assigned to these keys. Simply confirm that you do.
LinuxTaskManager-Custom-Shortcuts-Confirmation
What you need to do isn’t the same across all GNOME-based distributions. But for most of the major Linux desktop environments, the process is similar.

Command Line Tools

For more power, you want to dive into the command line. Here you can pull up extra information and expand your options.
Below are some of the essential commands.

ps

LinuxTaskManager-ps
ps stands for process status. Use this to show a list of processes running under the current user. You will see a name and process identification number (PID) that you can use when issuing other commands.

kill and killall

kill is one such command. Follow this up with a PID to terminate that process. If this fails, add the signal 9 to increase your chances of success.
kill -9 2470
By default, kill uses signal 15, named SIGTERM. Signal 9 is SIGKILL. The latter only fails when a process is making a request to the kernel. In such a circumstance, it will end after making the system call.
Use kill -l for the full list of signals.
LinuxTaskManager-kill
The killall command lets you end a process by name. If Firefox freezes up, you can use the following example to force close the application.
killall firefox

xkill

LinuxTaskManager-xkill
Sometimes you don’t know the actual name of an application. In that case, you can take a more graphical approach. Type xkill into the terminal to turn the cursor into an X. Then click on the window that is not responsive and watch it disappear.

top

LinuxTaskManager-top
The top command shows which tasks are putting the most strain on your CPU. You can sort the list by CPU or RAM usage, how long the program has been running, and other factors.

vmstat

LinuxTaskManager-vmstat
Instead of viewing this information live, you can take a snapshot. vmstat does just that. You get an instant view of currently running processes and how much memory they’re using.

free

LinuxTaskManager-free
This command shows how much memory is available. Columns show free and used physical and swap memory. Plus you can see buffers used by kernel.

lscpu

LinuxTaskManager-lscpu
Some of the information you get from the above commands don’t make sense without context. How many CPUs does your computer have? What architecture type are you using? Use lscpu to see this information presented in a way that makes sense.

Post a Comment