Ubuntu – How to check the niceness

niceps

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

Best Answer

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:

ps ax -o pid,ni,cmd
This will list the process ID, the nice level, and the actual command.


Example:

  $ps ax -o pid,ni,cmd
  PID  NI CMD
    1   0 /sbin/init
    2  -5 [kthreadd]
    3   - [migration/0]
    4  -5 [ksoftirqd/0]
    5   - [watchdog/0]
    6   - [migration/1]
    7  -5 [ksoftirqd/1]
    8   - [watchdog/1]