Install and use 'htop' when the Linux 'top' command isn't wide enough or is too hard to read

I was trying to troubleshoot an issue on an NVIDIA AI Workbench WSL instance and the top program didn't show enough information.  It was hard to read the monochrome output and the command section was too narrow to tell me the full program launch commands with all the parameters.  The NVIDIA VMs had htop installed which colorized pieces of information and displayed at full widescreen width.

Installation htop on Ubuntu

  1. Install with apt
    1. apt update && apt install htop
  2. in my case sudo apt
    1. sudo apt update && apt install htop 

Installing htop in a WSL Instance (Ubuntu)

  1. Find the WSL instance
    1. wsl -l -v
  2. Shell into the VM using the wsl command
    1. wsl -d <wsl instance name>
  3. Install htop
    1. sudo apt update && apt install htop

Installing htop in a docker desktop WSL instance (Alpine)

I wanted to see what was happening in the WSL instance that runs my Docker containers to see the CPU load and process details.
  1. Shell into the Docker Desktop wsl instance with 
    1. wsl -d docker-desktop
  2. Install htop with apk
    1. apk update && apk add htop

htop in action

  1. Unlimited screen width
  2. More detailed CPU and memory graphs
  3. Color highlighting and text
  4. Menu at the bottom 
This is what htop shows when run on an NVIDIA Workbench WSL instance
NVidia Workbench WSL instance

top 

This is the standard output for the top command run on an NVIDIA workbench WSL instance.

NVIDIA Workbench WSL instance with top


Revision History

Created 2025/05

Comments

Popular posts from this blog

Understanding your WSL2 RAM and swap - Changing the default 50%-25%

Installing the RNDIS driver on Windows 11 to use USB Raspberry Pi as network attached

DNS for Azure Point to Site (P2S) VPN - getting the internal IPs