How to install htop on pfSense firewall

last updated in Categories , , ,

I am using pfSense version 2.4.4-RELEASE-p3 (FreeBSD 11.2-RELEASE-p10). How do I install htop version 2.x on a pfSense firewall?

htop is an awesome and interactive system-monitor process-viewer. It acts as an alternative to the FreeBSD program top. It is a text-mode application and latest version works on FreeBSD based pfsense firewall too. This page explains how to install htop on pfSense.

Install htop on pfSense

You need to log in using ssh client:
ssh admin@your-pfsense-firewall-ip-here
ssh admin@192.168.2.254

Select option # 8 (shell).
Sample outputs:

Fig.01: pfsense ssh login
Fig.01: pfsense ssh login

To install htop, type:
pkg install htop
Sample outputs:
Fig.02: installing htop on a pfsense
Fig.02: installing htop on a pfsense

How do I use htop on pfSense firewall?

Simply type htop at the shell prompt (you may need to type rehash for the first time):
htop
Sample outputs:

Animated gif 01: htop in action
Animated gif 01: htop in action

How do I show only processes of a given user?

To see only processes of a given user (say nixcraft), enter:
htop -u nixcraft
htop --user=nixcraft

How do I show only the given PIDs?

The syntax is:
htop -p PID,[,PID,PID...]
htop --pid=PID,[,PID,PID...]
htop -p 31151,24721

How do I disable color scheme?

To see a monochrome color scheme, enter:
htop -C
htop --no-color

pfSense 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.

Conclusion

You learned how to install htop on pfSense firewall. htop command has many more option. Hence, see the htop home page online here or read man page by typing the following command:
man htop

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

3 comment

  1. Installing apps that are not in the PFSense Package Manager comes with some risk. Adding programs that are not tested by the PFSense team can have an impact on the security of the firewall. Personally, I wouldn’t risk it.

    1. htop installed from PFSense repo and not from the official FreeBSD repo. So I don’t see how this is going to provide some risk. The official FreeBSD repo are disabled for pkg.

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