The top command displays Linux processes, and one of the first packages I install on a new Linux setup is the enhanced, interactive htop viewer. Good-looking and easy to use: see CPU and MEMORY usage at a glance, system load and uptime, kill wonky processes, and more!
Install: On Ubuntu/Debian ...
$ sudo apt install htop lsof
To search for a specific process ID (PID) just input the number in the htop window and ENTER to select.
Menu function keys F1->F10 may conflict with desktop environment settings. Fortunately there are many keycode shortcuts, and these are the ones I find most useful ...
- help menu
- toggles the tree view which displays all related processes
- show all files opened by a process (uses lsof)
- select a user and display only processes belonging to that ID
- search for process by keyword
- filter processes by keyword
- Shift + f
- follow a process
- Shift + .
- sort menu, Shift + i will invert the sort
- Shift + p
- shortcut to sort processes by CPU ...
- Shift + m
- ... by MEMORY ...
- Shift + t
- ... or TIME
- toggle a tag (useful for selecting multiple processes to kill)
- Shift + u
- remove all tags
- kill process menu