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
    htop takes multiple pids in the form -p PID,PID.... Was that what you typed? – JigglyNaga Oct 30 '18 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 – BlueBottle Oct 31 '18 at 4:44
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.

  • Thank you for the suggestion, I did try that and it is working, thanks! – BlueBottle Oct 31 '18 at 4:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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