Categories
Linux Tutorial Series

Linux Tutorial Series – 104 – The pgrep and pkill commands

Here is the video version, if you prefer it:

Today, I will just throw a bug in your ear (this is a colloquialism in Croatia for “useful for you to know”) and tell you about two commands I have used – pgrep and pkill.

You most likely won’t be needing those commands in most cases, but sometimes you know only the process name, but don’t know its ID and you want to end the process. Then you can use pgrep in combination with xargs (see here: (“Can I chain pgrep with kill?,” n.d.)⁠) or use pkill with the process name as the argument (“pkill(1) – Linux man page,” n.d.)⁠.

Hope you learned something useful!

References

Can I chain pgrep with kill? (n.d.). Retrieved February 10, 2020, from https://unix.stackexchange.com/questions/138202/can-i-chain-pgrep-with-kill

pkill(1) – Linux man page. (n.d.). Retrieved February 10, 2020, from https://linux.die.net/man/1/pkill