htop-dev / htop

htop - an interactive process viewer
https://htop.dev/
GNU General Public License v2.0
6.36k stars 431 forks source link

Feature request: print pid and exit #1444

Open lolbinarycat opened 5 months ago

lolbinarycat commented 5 months ago

often i want to use htop to find a specific process, then give that PID to a different process.

because of the (usually convenient) mouse support, i can't simply copy and paste it (besides, this option isn't available to anyone using a vt).

my requested solution is a keyboard shortcut that exits htop and prints the pid of the selected process(es) to stdout, similar to the behavior of fzf.

BenBE commented 5 months ago

You can hold SHIFT with most terminal emulators while selecting text.

Also, you can use -M/--no-mouse to disable mouse support temporarily …

Furthermore there's pgrep available to lookup PIDs if there's usually just one process started that matches your criteria.