4

I wanted to get information about the threads of a process. I used the /proc/stat command in the terminal but I get a "permission denied" error. How can I resolve this issue?

1
  • 1
    /proc/stat is not a command. What do you mean by threads of a process? The PIDs of the threads? Commented Jul 11, 2017 at 6:14

3 Answers 3

4

To get number of threads of a process, execute

grep Threads /proc/<PID>/status
3

You can display threads with ps command as well:

THREAD DISPLAY
        H     Show threads as if they were processes.
       -L     Show threads, possibly with LWP and NLWP columns.
        m     Show threads after processes.
       -m     Show threads after processes.
       -T     Show threads, possibly with SPID column.

For example:

ps -T -p $pid

to display threads with SPID number of process with PID $pid.

2

You cannot execute /proc/stat, you can view it, for example with

cat /proc/stat

/proc is a pseudo-filesystem with lots of system information to view. See man proc for details. You can read details about linux /proc/stat for example at this page

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.