What processes can the long killer utility terminate?
sobes.tech AI
Answer from AI
The utility long killer (presumably referring to pkill) can terminate processes based on various criteria:
-
By process name: Terminate all processes with a given name.
# Terminate all processes named "nginx" pkill nginx -
By user UID: Terminate all processes belonging to a specific user.
# Terminate all processes of user "user1" pkill -U user1 -
By group GUID: Terminate all processes belonging to a specific group.
# Terminate all processes of group "developers" pkill -G developers -
By signal: Send a specific signal to a process. By default,
SIGTERMis sent.# Send SIGKILL (9) signal to process named "my_app" pkill -9 my_app -
By process ID (PID): Although
pkillis mainly used for terminating processes by other criteria, it can also be used with PID, although traditionallykillis used for this.# Terminate process with PID 12345 pkill 12345 -
By regular expression pattern: Terminate processes whose names match a given regex.
# Terminate processes whose names start with "java" pkill ^java -
By terminal: Terminate all processes associated with a specific terminal.
# Terminate all processes on terminal ttyS0 pkill -t ttyS0 -
By launch time: Terminate processes launched more or less recently.
# Terminate processes launched more than 1 hour ago pkill -o 1h # Terminate processes launched less than 5 minutes ago pkill -n 5m
It is important to note that pkill is a more flexible utility compared to killall, as it supports regular expressions.