htop icon indicating copy to clipboard operation
htop copied to clipboard

Option to search or filter by specific columns

Open CharlesARoy opened this issue 2 years ago • 2 comments

Hello, I was wondering if htop supports the ability to search and filter by specific columns?

Currently, when I search or filter (F3/F4) it seems like the search only considers the Command column. Is there a way to search and filter by other columns? For example, in htop, how would I display only the processes running on a given CPU? I know I can sort by CPU and then navigate to a given CPU number, but it would be nice if I could filter the results by the CPU column.

image

I am running htop version 3.2.0 on a very old version of Ubuntu (14.04.6).

Apologies if this is already possible and documented somewhere, I wasn't able to find anything about it.

CharlesARoy avatar May 12 '22 16:05 CharlesARoy

The search and filtering logic in htop is very limited and currently only takes the Command column into account. Another option you have is to search/filter for a certain PID by entering it in the UI (IIRC without actively activating the search/filter).

A much more comprehensive filtering/search would absolutely be fantastic, but is not currently implemented. The most recent change that happened was #963, which added the ability to look for multiple terms at the same time by separating them with |: calm|peace|health|happiness.

BenBE avatar May 12 '22 19:05 BenBE

Just FTR: pressing u also allows filtering processes for one specific user (or reset to show processes of all users).

fasterit avatar May 13 '22 07:05 fasterit

If this issue is still open, I would like to try and see what I can do. I'm not sure how quickly I'll be able to generate a solution as I'm slowly getting familiar with the code base but will try to take a crack at it.

This will be my first attempt at contributing to an open source repo so I look forward to contributing to it. May ask about some questions I'll get in the process if that's okay

Arrhenius avatar Jan 13 '23 03:01 Arrhenius