How to Enable Swap Usage Details in htop Ubuntu
Monitoring system performance is essential for maintaining a healthy Ubuntu environment. The htop utility provides an interactive view of system processes and resource consumption, including memory and swap space. While swap usage is often visible by default, users may need to configure specific meters or columns to track it effectively. This guide explains the steps to ensure swap usage details are displayed correctly within the htop interface on Ubuntu.
Prerequisites
Before configuring htop, ensure that swap space is active on your system and the utility is installed. Open your terminal and run the following command to verify swap status:
swapon --showIf no output appears, you need to create a swap file or partition first. Next, install htop if it is not already present:
sudo apt update
sudo apt install htopConfigure htop Meters
Launch htop by typing htop in the terminal. By default,
the header may show memory usage but omit specific swap details. To add
the swap meter:
- Press F2 to open the Setup menu.
- Navigate to the Meters section.
- In the left column labeled “Available meters,” find Swap.
- Select Swap and press F5 to add it to the “Active meters” column on the right.
- Use F6 to move the Swap meter to your preferred position in the header.
Add Swap Column to Process List
To see how much swap individual processes are using, you must enable the SWAP column in the process list:
- While still in the Setup menu (F2), use the right arrow key to switch to the Columns tab.
- Scroll through the list until you find SWAP.
- Press the Spacebar to toggle the checkbox next to SWAP, enabling it.
- Use F5 or F6 to adjust the column order if desired.
Save and Exit
Once you have configured the meters and columns, press F10 to save your changes and return to the main htop screen. You will now see the total swap usage in the header meters and the specific swap consumption per process in the list. Press q to quit htop when finished.