Is there any way to check my nice lvl? I did try with ps
, but for some reason the output does not show the column NI which is meant to show the lvl priority if I'm not wrong.
ps -fl -c
F S UID PID PPID CLS PRI ADDR SZ WCHAN STIME TTY TIME CMD
0 S sebas 9761 26810 TS 19 - 6564 wait 18:07 pts/4 00:00:00 bash
0 R sebas 25389 9761 TS 19 - 5661 - 18:27 pts/4 00:00:00 ps -fl -c
The -o flag allows you to specify columns. If you want to see your nice level, this would be in the NI column. So to see all processes with their nice level, do something like:
This will list the process ID, the nice level, and the actual command.Example:
I suggest you to use
htop
. It is a great monitoring application which also shows you the niceness of each process running on your box.There is an easier way than using the
-o
flag. The -l (lowercase L) flag of the ps command displays the nice values and current priority values of the specified processes.You can also use the
/proc
filesystem. If you want to find the nice level of process 3236, type:The process priority (a positive integer: bigger means higher scheduling priority) and the nice level are fields 18 and 19. Unfortunately, the nice value is printed as an unsigned integer, which means, if it's negative, that it will appear as a large integer near 2^32. For instance, I started process 3236 with the command
/bin/nice -n 19 python
. This is what /proc/3236/stat looks like:The priority and nice values are 1 and 4294967277. 4294967277 is -19 rendered as a 32-bit unsigned integer.
/proc
is convenient if you want to examine properties of a process in a program.Here is the man page for the
/proc
filesystem.