Are you using memory-intensive processes? Do you need to closely monitor containers and virtual systems on your computer? htop is the tool you’ve been looking for.
Aug 11, 2020 Open the Terminal app on mac OS and type the following command; brew install htop; Start htop at the bash shell on the Mac OS or computer. Let us see how to search and install htop in details on Apple MacBook Pro running macOS. Search for htop. The command is as follows: brew search htop OR brew info htop. The problem is, htop doesn't seem to be accurate in displaying what processes are using CPU resources. For instance, in the screenshot, all of the cores are 100% busy but htop displays nothing (it should show the 'FahCorea7' process as consuming all the CPU, if I look at Activity Monitor on the target this is.
Its color-coded display makes it easy to understand the status of your system at a glance and gives you the power to manage processes with a single keystroke.
What is htop?
htop is a text-mode (console or terminal) process application for Unix systems. It plays three primary roles:
Top / htop for GPU? Viewed 1k times 0. I have been having some of the worst performance problems with my Mac Pro that I've ever seen. It seems to start at the darnedest times with no apparent provocation. It is not htop-like, but you could use atop. However, to display disk activity per process, it needs a kernel patch (available from the site). These kernel patches are now obsoleted, only to show per-process network activity an optional module is provided.
- System monitor.
- Process-viewer.
- Process manager.
htop is interactive via mouse and keyboard. It has bright colors that aid in giving quick, visual, at-a-glance information about your system’s status. Tasks like finding and killing pesky processes can be easily performed without entering their PIDs, and the list of processes can be quickly sorted and filtered.
I rely on htop for the information I need to know how well my computer and docker containers are running. It makes it super easy to closely monitor resource-hungry processes and ensure that they don’t get out of hand.
How to Use htop
Setup
To get started using htop, install it by running the following command:
- Linux:
sudo apt-get install htop
- Mac:
brew install htop
Then, run the command
htop
.I’ll walk you through the critical parts of the interface.
CPU and Memory Usage
At the very top, there are multiple numbered bars with colorful
|
ticks. Each bar represents a CPU core, and the colorful ticks inside the bar represent the load on that core.The number of bars depends on the number of cores your CPU has. For example, if your computer has 8 cores, there will be 8 bars. The colors represent the type of process running on that core:
- Blue: low priority processes.
- Green: normal (user) processes.
- Red: kernel processes.
Below the CPU bars are the memory (Mem) and swap (Swp) rows. Just like the CPU, these rows have colorful ticks that represent the amount of memory being consumed by processes running on the computer. Their colors represents the following:
- Green: used memory pages.
- Blue: buffer pages.
- Yellow: cache pages.
Tasks, System Load Averages, and Uptime
Next to the memory bars, there is a section that shows the system tasks, load average, and uptime:
- Tasks are the number of open processes on the system. There are three values shown: the total number of tasks (processes) on the machine, the number of threads those tasks are broken up into, and the number of tasks currently running.
- Load average is a measure of the computational work performed by the CPU. A single-core CPU with 100% utilization has a 1.0 load average. A quad-core CPU with 100% utilization has a 4.0 load average. There are three load average numbers listed, representing the one-minute average, five-minute average, and fifteen-minute average.
- Uptime is the total system uptime since its last reboot.
Process Information
htop provides a list containing all the running processes on the system being monitored. Each column on the header represents the following:
- PID: process ID number.
- USER: process owner.
- PRI: process priority by the kernel.
- NI: process priority reset by the user or root.
- VIR: virtual memory the process is consuming.
- RES: physical memory the process is consuming.
- SHR: shared memory that the process is consuming.
- S: current process state.
- CPU%: percentage of CPU that the process is consuming.
- MEM%: percentage of memory that the process is consuming.
- TIME+: time measured in clock ticks since process execution started.
- Command: name of the command that started the process
The footer contains basic menu commands. Some key ones include: Mac desktop wallpaper 4k.
- F2 to tweak features.
- F3 for searching processes.
- F4 for filtering processes.
- F5 shows a process tree.
- F6 sorts processes by specific columns.
- F9 kills the highlighted process.
Useful Shortcut Keys
To truly become a master at using htop, be sure to use these handy shortcuts.
- u: displays all processes owned by a particular user.
- p: sort processes on high CPU consumption.
- m: sort processes on high memory consumption.
- t: sort process on time.
- Space: tag a process
- c: tag a process and child processes
- Shift + u: remove all tags.
- Shift + f: highlight and follow a process.
- Shift + h: show/hide user and kernel processes.
- a: set what CPU cores a process can access.
- i: set IO priority.
- h: help menu.
Conclusion
If you are looking for an easy-to-use process manager, there is no question that htop is the best. Hopefully, this beginner’s guide helped you understand htop and utilize it to its full potential.
About the App
- App name: htop-osx
- App description: Improved top (interactive process viewer) for OS X
- App website: https://github.com/max-horvath/htop-osx
Install the App
- Press
Command+Space
and type Terminal and press enter/return key. - Run in Terminal app:
ruby -e '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)' < /dev/null 2> /dev/null
and press enter/return key.
If the screen prompts you to enter a password, please enter your Mac's user password to continue. When you type the password, it won't be displayed on screen, but the system would accept it. So just type your password and press ENTER/RETURN key. Then wait for the command to finish. - Run:
brew install htop-osx
Done! You can now use
htop-osx
.