Today I Learned - Rocky Kev

TIL how to force-quit in Linux Terminal

POSTED ON:

TAGS:

You know how in Windows, when you have that problem like a hanging software, you can Force Quit it?

Mac has it too.

But how exactly do you that in a Linux environment?

I was goofing off with my raspberry pi and broke something. There were errors, and then other things wouldn't work.

The key word is Process Status (ps)
$ ps

Let’s say you know the Chrome process is what you need to kill... For that, you can make use of the ps command and filter the output through grep. The ps command reports a snapshot of a current process and grep prints lines matching a pattern. The reason why we filter ps through grep is simple: If you issue the ps command by itself, you will get a snapshot listing of all current processes. We only want the listing associated with Chrome. So this command would look like:

$ ps aux | grep chrome

a = show processes for all users
u = display the process’s user/owner
x = also show processes not attached to a terminal

Then to kill it, you get the PID.
So if Chrome was PID 12345, you would do:

kill -9 12345

9 - represents the Kill signal

More info on killing processes


Related TILs

Tagged:

TIL Trovald's Magic Numbers

These magic numbers are intended to safeguard against a typo or potential bit flips in the syscall number. Since reboot is a destructive and non-syncing operation, it's important to make absolutely sure that it isn't called accidentally due to a typo, a misbehaving program, or memory error

TIL linux user groups

UID 0 is reserved for root user. UID 1-99 is reserved for other predefined accounts. UID 100-999 is reserved for system accounts. Also notice that user accounts tend to start at 1000. UID above 999 are for normal user accounts.

TIL How to determine what security group you're in

These commands will help you figure out what group you're in, and if you belong to the group that can modify files.