Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to know how to find out my PID processing ID. However when I try to do this it says:

cat: /proc/PID/status: No such file or directory

The command I tried is:

cat /proc/PID/status
share|improve this question

3 Answers 3

In most shells and in Perl, your current pid is in the variable $$:

$ echo $$
14886
$

$ perl -e 'print "$$\n"'
15006
$
share|improve this answer

In /proc/PID/status, PID is a placeholder for an actual process ID. You can't just call cat /proc/PID/status because that doesn't exist.

If you want to find out a process ID, just use

ps -ef | grep -i "process name" | grep -v grep

The PID will be the second column, the third column is the parent process ID.

share|improve this answer

The easiest way is to use the top command on a terminal for output like this:


top - 11:09:20 up 9 min, 2 users, load average: 0.14, 0.39, 0.39 Tasks: 178 total, 2 running, 176 sleeping, 0 stopped, 0 zombie Cpu(s): 2.3%us, 1.0%sy, 0.0%ni, 96.5%id, 0.0%wa, 0.0%hi, 0.2%si, 0.0%st Mem: 3081644k total, 1178648k used, 1902996k free, 128244k buffers Swap: 0k total, 0k used, 0k free, 392340k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2595 user 20 0 82868 21m 11m S 3 0.7 0:13.02 npviewer.bin
1375 root 20 0 167m 15m 8400 S 2 0.5 0:13.72 Xorg
2665 user 20 0 397m 15m 11m S 1 0.5 0:00.24 gnome-terminal
2689 user 20 0 19276 1364 956 R 1 0.0 0:00.09 top
2073 user 20 0 310m 33m 8568 S 0 1.1 0:05.65 compiz
2200 user 20 0 212m 10m 8240 S 0 0.3 0:01.97 multiload-apple
2469 user 20 0 612m 63m 32m S 0 2.1 0:17.31 chromium-browse


The first column of the output with the four digit numbers (in this particular output) is the process ID for the process name at the far right of the table. BTW, press 'q' to exit top or it will keep polling and updating endlessly every few seconds.

top only shows a screenful's worth of lines with the hungriest processes rather than the dozens of total processes. You can use slhck's pattern to find other processes. Even my own example had about 200 processes running.

You probably are looking for your process ID as an intermediate step to something else. If you need to kill a process, because it's out of control, you can research kill and killall. you can type man kill and it will give you useful info. To exit that *man*page and most other interactive CLI programs such as top, press 'q'.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.