You can easily get the usage of individual cpu core on FreeBSD based system using top command itself.
How to display per-cpu CPU usage statistics on FreeBSD
Type the following command:
$ top -P
Sample outputs:
$ top -PCH
You can set the environment variable named TOP to set your own defaults. For bash/sh/ksh shell set the following in your shell startup file:
$ export TOP='-P'
OR for tcsh:
$ setenv TOP -P
Say hello to vmstat
You can use the vmstat command as follows:
$ vmstat -P
You should see per-cpu system/user/idle cpu statistics with vmstat as follows
procs memory page disks faults cpu0 cpu1 cpu2 cpu3 cpu4 cpu5 cpu6 cpu7 r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id us sy id us sy id us sy id us sy id us sy id us sy id us sy id 0 2 0 3493M 21G 333 0 0 0 312 36 0 0 236 2769 1281 0 1 99 1 1 99 0 0 99 0 0 99 0 1 99 0 1 99 0 1 99 0 1 99
Install htop command
Htop is a free (GPL) ncurses-based process viewer for Linux and Unix-like system including FreeBSD. Type the following command to install htop:
$ sudo pkg install htop
Sample outputs:
Updating FreeBSD repository catalogue... FreeBSD repository is up-to-date. All repositories are up-to-date. The following 3 package(s) will be affected (of 0 checked): New packages to be INSTALLED: htop: 2.0.2 libexecinfo: 1.1_3 lsof: 4.90.g,8 Number of packages to be installed: 3 183 KiB to be downloaded. Proceed with this action? [y/N]: y [webserver] Fetching htop-2.0.2.txz: 100% 63 KiB 21.5kB/s 00:03 [webserver] Fetching libexecinfo-1.1_3.txz: 100% 8 KiB 8.6kB/s 00:01 [webserver] Fetching lsof-4.90.g,8.txz: 100% 112 KiB 57.3kB/s 00:02 Checking integrity... done (0 conflicting) [webserver] [1/3] Installing libexecinfo-1.1_3... [webserver] [1/3] Extracting libexecinfo-1.1_3: 100% [webserver] [2/3] Installing lsof-4.90.g,8... [webserver] [2/3] Extracting lsof-4.90.g,8: 100% [webserver] [3/3] Installing htop-2.0.2... [webserver] [3/3] Extracting htop-2.0.2: 100%
To view stats, type:
$ htop
Sample outputs:
🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 2 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Nice. I did not know that I could press ‘1’ to see cpu threads and always installed htop instead, which is also great. I think you got the export wrong, did you mean `export TOP=’top -P’`
No, that is correct. From man top: