Jack Wallen shows you the basic difference between two commands that end with the same results ... closing unresponsive applications.
It's a rare occasion that a Linux application will run astray, but it does happen. This most often happens with user-facing apps, such as browsers, office suites and the like. When that happens, what do you do? You turn to kill or killall, two commands that give you absolute control over whether an application can continue running or not.
SEE: 5 Linux server distributions you should be using (TechRepublic Premium)
If you find an app has become unresponsive, either kill or killall will never fail to show that app who's boss: You. But which command should you use?
To be honest, I almost always use killall. Why? Because with the killall command I don't have to worry about first finding the PID of the running process. And when you need to get rid of a process quickly, nothing beats killall.
The only caveat to using killall is that you have to know the real name of the process. For instance, you couldn't just issue the command killall libreoffice, because the command used to launch the tool might be soffice.bin.
So, there's the trick with using killall. You need to know the name of the actual command and not the application. For that, I might launch top to see which apps are running, as it'll list them by command name.
I could stop LibreOffice with the killall soffice.bin command.
With the kill command, you kill by way of the process ID, so you'd first need to use a tool like top to find the PID. With the PID in hand, you could kill LibreOffice with a command like kill 279329.
The important thing to remember is the killall requires the actual command name of the app you want to force close, and kill requires the process ID of the application. Between these two commands, you have all the power at your fingertips to end wayward applications.
Open Source Weekly Newsletter
You don't want to miss our tips, tutorials, and commentary on the Linux OS and open source applications. Delivered Tuesdays
Sign up todayAlso see
- Linux 101: How to execute commands from within the nano text editor (TechRepublic)
- Linux 5.14 kernel: New and exciting features coming to the release (TechRepublic)
- How to become a software engineer: A cheat sheet (TechRepublic)
- 5 programming languages application solutions developers should learn (free PDF) (TechRepublic)
- The best programming languages to learn--and the worst (TechRepublic Premium)
- Must-read coverage: Programming languages and developer career resources (TechRepublic on Flipboard)