Top is the amazing utility that allows you to peek at the performance of your system. By default, top shows the overall system performance in the header and shows a subset of the running processes. Sometimes you're simply interested in a specific process and while the default presentation will show your process when it's part of the process subset list.
If you're interested in a specific process you can specify the process id on the command line:
$ top -p <pid>
That works very well, but requires you know the process id to specify.
The pgrep command allows looking up a process id by name. For example, if you're interested in the process id of top you can get it by specifying;
$ pgrep top
Pair these together and you can ask top to show the process overview of the top process;
$ top -p `pgrep top`
Hope you find this useful.
Cheers.
No comments:
Post a Comment