So we have been covering diffrent Linux command as previosuly we saw echo command in Linux now today we will see what are the Linux kill command and Enlist all the Linux kill commands with its function
The Linux Kill commands are:
- Killall: Killall command is used to kill all the processes with a particular name.
- Pkill: This command is a lot like killall, except it kills processes with partial names.
- Xkill: xkill allows users to kill command by clicking on the window
Difference between kill and kill -9
kill command sends a signal to a process. This can terminate a processes. However if some program is hung or not responding you may have to kill that program using -9 option which will kill a program no matter what.
kill -9 you may have to think twice while using
kill -9 as it will bypass any normal shutdown process and any unsaved data will be lost.
Killall Command in Linux
Unlike kill command killall command can terminate all processes by it’s name. For example, if you want to kill all processes used by firefox so instead of finding all process ID and killing them you can just do
-e. Find an exact match for the process name.
-I. Ignore case when trying to find the process name.
-i. Ask for additional confirmation when killing the process.
-u. Only kill processes owned by a specific user.
-v. Report back on whether the process has been successfully killed.
You term pkill command as search and kill. It will kill processes based on name but when other paramerters match.
pkill options pattern
pkill options include:
-n. Only kill the newest of the processes that are discovered.
-o. Only kill the oldest of the processes that are discovered.
-u. Only kill the processes that are owned by the selected user.
-x. Only kill the processes that match the pattern exactly.
-signal. Send a specific signal to the process, rather than SIGTERM.