6

How to list process priority on an embedded linux with busybox?

danatel
  • 437
  • 2
  • 4
  • 7

2 Answers2

6

Busybox can be compiled with ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS which will enable nice among others. Then you can do, for example:

busybox ps -o pid,nice,user,args

POSIX

  • user, group, comm, args, pid, ppid, pgid, tty, vsz

ENABLE_FEATURE_PS_TIME

  • etime, time

ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS

  • nice, rgroup, ruser, pcpu (although pcpu seems to be commented out)

Non-POSIX

  • rss

ENABLE_SELINUX

  • label
Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
3

If you have a cut-down Linux distribution where ps and top does not give you priority information, you can parse the stat file of proc for your process ID to get the priority information.

cat /proc/PID/stat | awk '{print "priority " $18 " nice " $19}'

The values at position 18 and 19 of stat file represent priority and nice

For more: https://linux.die.net/man/5/proc

Razan Paul
  • 211
  • 2
  • 5