How to install htop on Amazon Linux AMI

I am a new user of Amazon Linux AMI operating system. How do I install htop on Amazon Linux AMI using the yum command?

htop is nothing but Interactive process viewer for Amazon Linux AMI based system. It is just like default top command with an additional set of options and better display on the screen. This page shows how to install htop on Amazon Linux AMI using command line options.

ADVERTISEMENTS

How to install htop on Amazon Linux AMI using yum

The procedure for installing htop Amazon Linux AMI is as follows:

  1. Open the terminal window.
  2. For remote Amazon Linux AMI server login using ssh command.
  3. Execute yum search htop command to search for htop on Amazon Linux AMI
  4. Run sudo yum install htop to install htop in Amazon Linux AMI
  5. Want to update htop? Run sudo yum update htop

Let us see all steps and examples in details for Amazon Linux AMI.

Please note that [ec2-user@ip-172-26-2-145 ~]$ is my shell prompt. You need to type all commands after that prompt.

Amazon Linux AMI install htop

It is important that you know how to search for any packages. Therefore type the following command to search for htop package using yum command:
[ec2-user@ip-172-26-2-145 ~]$ yum search htop
Sample outputs:

Loaded plugins: priorities, update-motd, upgrade-helper
=================================== N/S matched: htop ====================================
htop.x86_64 : Interactive process viewer

  Name and summary matches only, use "search all" for everything.

Find information about htop package

Run the following command:
[ec2-user@ip-172-26-2-145 ~]$ yum info htop
Sample outputs:

Loaded plugins: priorities, update-motd, upgrade-helper
Available Packages
Name        : htop
Arch        : x86_64
Version     : 1.0.1
Release     : 2.3.amzn1
Size        : 81 k
Repo        : amzn-main/latest
Summary     : Interactive process viewer
URL         : http://htop.sourceforge.net/
License     : GPL+
Description : htop is an interactive text-mode process viewer for Linux, similar to
            : top(1).

Installing htop on Amazon Linux AMI

First, make sure you system is up to date:
[ec2-user@ip-172-26-2-145 ~]$ sudo yum update
[ec2-user@ip-172-26-2-145 ~]$ sudo yum upgrade

Finally, run the following to install htop on Amazon Linux AMI:
[ec2-user@ip-172-26-2-145 ~]$ sudo yum install htop

Install htop on Amazon Linux AMI using yum command

Installing htop on Amazon Linux AMI

How to use htop command

The syntax is:
htop
htop [options] htop [options] arg

Running htop on Amazon Linux AMI server

htop in action (better than top)

Press F10 or q to quit htop session.

One can use a monochrome color scheme, run:

[ec2-user@ip-172-26-2-145 ~]$ htop -C
[ec2-user@ip-172-26-2-145 ~]$ htop --no-color

Want to see the tree view by default when running htop? Try:

[ec2-user@ip-172-26-2-145 ~]$ htop -t
[ec2-user@ip-172-26-2-145 ~]$ htop --tree

Let us see only processes of a given user named vivek:
[ec2-user@ip-172-26-2-145 ~]$ htop -u vivek
[ec2-user@ip-172-26-2-145 ~]$ htop --user=vivek
[ec2-user@ip-172-26-2-145 ~]$ htop --user=nginx

Limit and show process for only the given PIDs:
[ec2-user@ip-172-26-2-145 ~]$ htop -p PID
[ec2-user@ip-172-26-2-145 ~]$ htop -p PID1,PID2
[ec2-user@ip-172-26-2-145 ~]$ htop --pid=PID,[,PID,PID...] [ec2-user@ip-172-26-2-145 ~]$ htop -p 1342
[ec2-user@ip-172-26-2-145 ~]$ htop -p 7435,1367

Amazon Linux AMI htop keyboard shortcut keys

The following commands are supported while in htop:

CommandDescription
Up arrow keySelect (highlight) the previous process in the process list. Scroll the list if necessary.
Down arrow keySelect (highlight) the next process in the process list. Scroll the list if necessary.
Left arrow keyScroll the process list left.
Right arrow keyScroll the process list right.
PgUp, PgDnScroll the process list up or down one window.
HomeScroll to the top of the process list and select the first process.
EndScroll to the bottom of the process list and select the last process.
sTrace process system calls: if strace(1) is installed, pressing this key will attach it to the currently selected process, presenting a live update of system calls issued by the process.
lDisplay open files for a process: if lsof(1) is installed, pressing this key will display the list of file descriptors opened by the process.

Other keyboard shortcuts

uShow only processes owned by a specified user.
MSort by memory usage (top compatibility key).
PSort by processor usage (top compatibility key).
TSort by time (top compatibility key).
F“Follow” process: if the sort order causes the currently selected process to move in the list, make the selection bar follow it. This is useful for monitoring a process: this way, you can keep a process always visible on screen. When a movement key is used, “follow” loses effect.
KHide kernel threads: prevent the threads belonging the kernel to be displayed in the process list. (This is a toggle key.)
HHide user threads: on systems that represent them differently than ordinary processes (such as recent NPTL-based systems), this can hide threads from userspace processes in the process list. (This is a toggle key.)
pShow full paths to running programs, where applicable. (This is a toggle key.)
Ctrl-LRfresh the screen.
F1See this help menu.

How to get help about htop

Simply pass the --help option. For example:
[ec2-user@ip-172-26-2-145 ~]$ htop --help
[ec2-user@ip-172-26-2-145 ~]$ man htop

Conclusion

This page showed you how to install and use htop on Amazon Linux AMI Unix server. It has many more option. Hence, see the htop home page online here or read man page.

This entry is 0 of 0 in the series. Keep reading the rest of the series:
    🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
    CategoryList of Unix and Linux commands
    File Managementcat
    FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
    Network Utilitiesdig host ip nmap
    OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
    Package Managerapk apt
    Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
    Searchinggrep whereis which
    User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
    WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

    ADVERTISEMENTS
    0 comments… add one

    Leave a Reply

    Your email address will not be published.

    Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.