Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the most general way to list all the kernel tasks in a linux system?

I am trying to figure out the best way to write a cross platform kernel code/shell script to list all the kernel task {(pid/tid , name)} in a linux dis. machine. it should be the most general possible. I tried to use ps -T but it is seems to be inaccurate and some platform don't support it in their busybox. Any suggestions?

like image 678
0x90 Avatar asked Dec 02 '25 09:12

0x90


1 Answers

If you want to distinguish user processes from kernel tasks, then this is a previous discussion on the subject: Identifying kernel threads

My answer to that question does not require any tools, it simply reads the contents of /proc//stat, so it should work on any distribution.

like image 111
er0 Avatar answered Dec 04 '25 00:12

er0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!