1

I have a binary that I will be running multiple times in parallel, each instance executed with different input from the command line. I wanted htop to list only these processes so that I can compare the usage of memory based on the cli inputs. I tried [htop -p ] but this lists only one process even if I give muliple process ids as the input. Is there any way to get the output with input being multiple process IDs or with the part of the process name.

Example as I hope to see in htop:

  PID USER      PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
  356 root       20   0 52952  7980  6632 S  0.0  0.8  0:00.00 ./test 1
  357 root       20   0 2356   416   352  S  0.0  0.8  0:00.00 ./test 2
  358 root       20   0 2356   332   268  S  0.0  0.8  0:00.00 ./test 3

Many thanks!

2
  • 2
    htop takes multiple pids in the form -p PID,PID.... Was that what you typed? Commented Oct 30, 2018 at 10:20
  • @JigglyNaga I tried giving the PID separated by a space but the output was only reflecting the process pointed by the first PID. I had not tried , I checked that now and it is working, thanks Commented Oct 31, 2018 at 4:44

1 Answer 1

1

From man htop:

F4, \
    Incremental  process  filtering:  type  in  part  of  a process command line and only
    processes whose names match will be shown. To  cancel  filtering,  enter  the  Filter
    option again and press Esc.

So, once you start htop, type \test and press Enter to filter in only commands containing test.

1
  • Thank you for the suggestion, I did try that and it is working, thanks! Commented Oct 31, 2018 at 4:54

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.