PID stands for “process ID” that have got every process in the system and thanks to this can be easily identified. This identification is necessary when we are going to send “signals” to a given process.
The list of the most common signals that we may want to send to the process is:
SIGTERM 15 is by default
KILL – command to sending signals.
kill -15 1234 – terminating process ID 1234
kill -9 1234 – killing process ID 1234
ps -aux -processes list
ps -ef the list with running programs
Killall (signal) name- (exact name) – if we have more users logged to the same server, that use the same process all of them will be rejected
pgrep – prints a list of matching processes based on the part of the name (alike search function).
pkill (signal) name – (the part of the process name or exact)
pgrep -a slee
pgrep -af slee – switch -f says “don’t search only for the process name but for entire command line”
Let’s have a look on the example.
I used pgrep command to list all processes with “smb” in the name:
next I used pkill command with entire name “smbd”, I could use only “smb”
and both processes 1521 and 1535 have been killed
Process Priorites (Nice Levels)
Each process consume server CPU. Thanks to prioritizing we are able to give some processes that are crucial the higher level, in Linux it is called Nice Levels
Default priority is equal 0. Let’s have a look on below chart
As we may conclude -20 is the highest level that we may assign to the process and
the lowest priority is 19.
nice – 10 medium low
nice – -15 very high
nice – 19 lowest priority
nice – -20 highest priority
no nice level = 0 – middle
How do we grant nice levels ?
ps -alf – the list of processes with nice levels
nice [number with dash] [name_of_process]
I’ve created some processes “sleep” and put them to the background “&”, I also set up the nice levels for them
Renice – changing levels for processes that are being in used already
renice (number) -p PID –
renice 19 -p 1234
renice -13 -p 1234
I’ve changed the “nice level” for PID 21380 from 10 to -19 so I increased its priority!