简体   繁体   中英

How to get Effective User Name and Schduling Class for a process using bash - linux

I'm trying to write a bash script that takes a process ID as the user input and prints out information about that process such as the nice value, priority ...etc. I almost got all what I need with help from this site: http://linux.die.net/man/5/proc

However, I couldn't find from where I can get the effective user name and the scheduling class of the process.

Any help would be appreciated.

The negated scheduling priority can be found as the 18th field of /proc/[pid]/stat as detailed in your link.

cat /proc/207/stat | cut -d' ' -f18

As for the owner of the process, it's the owner of the /proc/[pid] directory, or of any file in it.

stat -c "%U" /proc/207/

Edit : removed my scheduling priority calculation because I don't know the first thing about it and might misinterpret the documentation. I'll just leave where the negated one can be found.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM