How to install htop on OpenSUSE Linux using zypper

last updated in Categories , ,

I am a new sysadmin of OpenSUSE Linux operating system. How do I install htop on OpenSUSE using the zypper command?

htop is nothing but Interactive process viewer for OpenSUSE Linux cloud server or desktop 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 OpenSUSE using command line options.

How to install htop on OpenSUSE using zypper

The procedure for installing htop OpenSUSE is as follows:

  1. Open the terminal window.
  2. For remote OpenSUSE server login using ssh command. For example, vivek@server1.cyberciti.biz
  3. Execute zypper search htop command to search for htop on OpenSUSE
  4. Run sudo zypper install htop to install htop in OpenSUSE

Let us see all commands and examples in details to install htop on OpenSUSE.

Please note that nixcraft@opensuse-aws-vm:~$ is my shell prompt. You need to type all commands after that prompt.

OpenSUSE 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 zypper command:
nixcraft@opensuse-aws-vm:~$ zypper search htop
Sample outputs:

Loading repository data...
Reading installed packages...

S | Name | Summary                                           | Type   
--+------+---------------------------------------------------+--------
  | htop | An Interactive text-mode Process Viewer for Linux | package

Find information about htop package

Run the following command:
nixcraft@opensuse-aws-vm:~$ zypper info htop
Sample outputs:

Loading repository data...
Reading installed packages...
 
 
Information for package htop:
-----------------------------
Repository     : openSUSE-Leap-15.1-1                             
Name           : htop                                             
Version        : 2.2.0-lp151.2.3                                  
Arch           : x86_64                                           
Vendor         : openSUSE                                         
Installed Size : 215.0 KiB                                        
Installed      : No                                               
Status         : not installed                                    
Source package : htop-2.2.0-lp151.2.3.src                         
Summary        : An Interactive text-mode Process Viewer for Linux
Description    :                                                  
    htop is an interactive text-mode process viewer for Linux. It aims to be a
    better 'top' and requires ncurses.

Installing htop on OpenSUSE

First, make sure you system is up to date:
nixcraft@opensuse-aws-vm:~$ sudo zypper ref
nixcraft@opensuse-aws-vm:~$ sudo zypper update

Finally, run the following to install htop on OpenSUSE:
nixcraft@opensuse-aws-vm:~$ sudo zypper install htop

Install htop on OpenSUSE Linux using zypper command
Installing htop on OpenSUSE Linux

How to use htop command

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

Running htop on OpenSUSE Linux server
htop in action

Press F10 or q to quit htop session.

One can use a monochrome color scheme, run:

nixcraft@opensuse-aws-vm:~$ htop -C
htop --no-color

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

nixcraft@opensuse-aws-vm:~$ htop -t
nixcraft@opensuse-aws-vm:~$ htop --tree

Let us see only processes of a given user named nixcraft:
nixcraft@opensuse-aws-vm:~$ htop -u nixcraft
nixcraft@opensuse-aws-vm:~$ htop --user=nixcraft
nixcraft@opensuse-aws-vm:~$ htop --user=mysql

Limit and show process for only the given PIDs:
nixcraft@opensuse-aws-vm:~$ htop -p PID
nixcraft@opensuse-aws-vm:~$ htop -p PID1,PID2
nixcraft@opensuse-aws-vm:~$ htop --pid=PID,[,PID,PID...]
nixcraft@opensuse-aws-vm:~$ htop -p 3214
nixcraft@opensuse-aws-vm:~$ htop -p 4851,4272

OpenSUSE htop keyboard shortcut keys

The following commands are supported while in htop:

Command Description
Up arrow key Select (highlight) the previous process in the process list. Scroll the list if necessary.
Down arrow key Select (highlight) the next process in the process list. Scroll the list if necessary.
Left arrow key Scroll the process list left.
Right arrow key Scroll the process list right.
PgUp, PgDn Scroll the process list up or down one window.
Home Scroll to the top of the process list and select the first process.
End Scroll to the bottom of the process list and select the last process.
s Trace 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.
l Display 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

u Show only processes owned by a specified user.
M Sort by memory usage (top compatibility key).
P Sort by processor usage (top compatibility key).
T Sort 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.
K Hide kernel threads: prevent the threads belonging the kernel to be displayed in the process list. (This is a toggle key.)
H Hide 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.)
p Show full paths to running programs, where applicable. (This is a toggle key.)
Ctrl-L Rfresh the screen.
F1 See this help menu.

How to get help about htop

Simply pass the --help option to the htop command. For example:
nixcraft@opensuse-aws-vm:~$ htop --help
nixcraft@opensuse-aws-vm:~$ man htop

Conclusion

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

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at www.nixcraft.com

Historical Comment Archive

1 comment

    Still, have a question? Get help on our forum!