search for a process in top command

In this article, we would cover how to search for a process in top command. top command is a command-line utility which is used to list running processes. It, by default, sorts the output based on CPU usage. But, as you would notice there are numerous processes running and if they are sorted with something as dynamic as CPU usage. Then, it may get tough to read the data.

Therefore, we need to filter the output of top command. The easy way out could be – just search for the process we would like to track. Then, entire focus now shift towards that particular command. It would be easier to see the changes which occur with that process.

Just how we are going to achieve that is discussed next.

search for a process in top command

First, open a terminal and issue the following to launch top command-line utility –

top

It will show a list of processes.

Now, press key –

o

It will prompt us –

add filter #1 (ignoring case) as: [!]FLD?VAL

At this point, use field name and value. So, if we search for a command then provide the following details and enter –

COMMAND=<command_name>

For instance, if we search for Xorg then it would be –

COMMAND=xorg

It is worth mentioning here that, the search filter will ignore case. So, that is the reason we could search Xorg with input xorg. But, in case of field name it won’t ignore case.

Not only with COMMAND field, we can also use other fields as well. Let’s see how it works for USER and PID fields.

If we want to search only those processes which are running for a particular user. Then,

USER=<user_name>

If we want all the processes which have the PID greater than 1000 –

PID>1000

There are numerous such combinations we can make.

In conclusion, we have discussed how to search for a process in top command. If you want to know more about listing processes with top command.

Similar Posts