Linux basic health check commands - Linux Tutorials - ... https://linuxconfig.
org/linux-basic-health-check-commands
Menu
Linux basic health check commands
9 August 2022 by Korbin Brown
There are a variety of tools that a system administrator can use to check and monitor
the health of their Linux system. This would include not only the physical hardware,
but also the so�ware and how many resources are being dedicated to running the
installed services. In this tutorial, you will learn several commands to check overall
health of your Linux system from the command line.
In this tutorial you will learn:
• How to check system processes, CPU usage, and RAM usage
• How to check hard drive diagnostics and input/output operations
• How to monitor network activity and hardware temperatures
1 of 13 4/7/23, 12:33 PM
Linux basic health check commands - Linux Tutorials - ... https://linuxconfig.org/linux-basic-health-check-commands
Linux basic health check commands
So�ware Requirements and Linux Command Line Conventions
Category Requirements, Conventions or So�ware Version Used
System Any Linux distro
So�ware top, htop, free, smartmontools, sysstat, lm-sensors, ss
Privileged access to your Linux system as root or via the sudo
Other
command.
# – requires given linux commands to be executed with root
privileges either directly as a root user or by use of sudo command
Conventions
$ – requires given linux commands to be executed as a regular non-
privileged user
Linux basic health check commands
Check out the commands below to see our compiled list of the best health check
tools on Linux. Most of these tools are installed by default on all major Linux distros,
but we have included installation instructions for the few tools that will need to be
installed via system package manager.
top and htop – Process Monitoring
2 of 13 4/7/23, 12:33 PM
Linux basic health check commands - Linux Tutorials - ... https://linuxconfig.org/linux-basic-health-check-commands
The top command is installed by default and is a great way to see CPU and RAM
usage on your system. It will also allow you to check which processes are consuming
the most system resources. This will give you insight as to whether or not it may be
necessary to upgrade system components, or rein in services that may be tying up an
unreasonable amount of system CPU or memory.
$ top
Linux top command output
A better alternative would be the htop command, which is just like top but more
human readable. It gives you a summary that is easier to digest and interact with, but
the program is usually not installed by default. If possible, it is highly recommended
to install this program and use it to get a quick glimpse of which processes are
chewing up the majority of your systemʼs hardware resources.
To install htop:
$ sudo apt install htop # Ubuntu, Debian, Linux Mint
3 of 13 4/7/23, 12:33 PM
Linux basic health check commands - Linux Tutorials - ... https://linuxconfig.org/linux-basic-health-check-commands
$ sudo dnf install htop # Fedora, Red Hat, CentOS, AlmaLinux
$ sudo pacman -S htop # Arch Linux, Manjaro
To use htop:
$ htop
Linux htop command output is more user friendly
free – Memory Usage Statistics
The free command is installed by default and allows you to check RAM usage as
well as monitor it in real time.
# free -h
total used free shared buff/cache available
Mem: 1.9G 784M 145M 20M 1.0G 1.0G
4 of 13 4/7/23, 12:33 PM
Linux basic health check commands - Linux Tutorials - ... https://linuxconfig.org/linux-basic-health-check-commands
Swap: 947M 0B 947M
The -s (seconds) switch allows free to run continuously, issuing new output every
speci�ed number of seconds. For example, to run the free command every 3
seconds:
# free -s 3
To see more free usage examples and explanations, check out our tutorial on How
to Monitor RAM Usage on Linux.
SMART Data – Check Hard Drive Health
All hard drives collect data about their performance statistics, bad sectors, power on
hours, and other information. These stats are known as SMART (Self Monitoring
Analysis and Reporting Technology) data, and can be viewed if your system has the
smartmontools package installed.
To install smartmontools:
$ sudo apt install smartmontools # Ubuntu, Debian, Linux Mint
$ sudo dnf install smartmontools # Fedora, Red Hat, CentOS, AlmaLinux
$ sudo pacman -S smartmontools # Arch Linux, Manjaro
To use smartmontools to check the current status of a hard drive (/dev/sda):
$ sudo smartctl -a /dev/sda
To see more smartctl usage examples and learn how to run diagnostic tests on your
hard drives, check out our tutorial on How to check an hard drive health from the
command line using smartctl.
5 of 13 4/7/23, 12:33 PM
Linux basic health check commands - Linux Tutorials - ... https://linuxconfig.org/linux-basic-health-check-commands
Hard Drive Input/Output Statistics
If you are working with computers that do lots of read/write operations, like a busy
database server, for instance, you will need to check disk activity. This can be done
with the help of the iostat command, which will give us statistics about the input
and output operations of all the hard disks in our system.
iostat is available in the sysstat package. To install sysstat:
$ sudo apt install sysstat # Ubuntu, Debian, Linux Mint
$ sudo dnf install sysstat # Fedora, Red Hat, CentOS, AlmaLinux
$ sudo pacman -S sysstat # Arch Linux, Manjaro
To use iostat :
$ iostat
Or to run continuously for 10 seconds:
$ iostat -d 1 10
6 of 13 4/7/23, 12:33 PM
Linux basic health check commands - Linux Tutorials - ... https://linuxconfig.org/linux-basic-health-check-commands
Command output of the iostat command on Linux
Hardware Temperature Monitoring
Another basic health check to perform is monitoring your systemʼs temperature.
Incorrectly installed heat sinks, clogged vents, or dust-ridden chassis fans can lead
to high temperatures, which are a detriment to the longevity of system components,
including the CPU, video card, etc. This can be accomplished through the sensors-
detect command.
sensors-detect is available in the lm_sensors package. To install lm_sensors:
$ sudo apt install lm-sensors # Ubuntu, Debian, Linux Mint
$ sudo dnf install lm_sensors # Fedora, Red Hat, CentOS, AlmaLinux
$ sudo pacman -S lm_sensors # Arch Linux, Manjaro
To use sensors-detect :
$ sudo sensors-detect
k8temp-pci-00c3
Adapter: PCI adapter
Core0 Temp: +32.0°C
Core0 Temp: +33.0°C
Core1 Temp: +29.0°C
Core1 Temp: +25.0°C
nouveau-pci-0200
Adapter: PCI adapter
temp1: +58.0°C (high = +100.0°C, crit = +120.0°C)
7 of 13 4/7/23, 12:33 PM
Linux basic health check commands - Linux Tutorials - ... https://linuxconfig.org/linux-basic-health-check-commands
Network Activity Monitoring
The ss command is the successor to the netstat command on Linux systems. The
command is used by system administrators to see information about network
connections. This means we can check the health of our network by understanding
which processes and services are communicating across our local network as well as
the internet.
The ss command also allows you to check things like the status, origin, and
destination of connections. In addition, ss displays route tables, interface statistics,
masquerade connections, and multicast memberships.
It should already be installed by default on all major Linux distros. It comes with
many extra options, or you can just run the command by itself (recommended to run
as root):
$ sudo ss
8 of 13 4/7/23, 12:33 PM
Linux basic health check commands - Linux Tutorials - ... https://linuxconfig.org/linux-basic-health-check-commands
Output of the ss command on Linux
To see more about the ss command, including usage examples and options, check
out our tutorial on Using ss command on Linux.
Closing Thoughts
In this tutorial, we saw how to use commands to perform a basic health check on a
Linux system. This included commands to check system processes, hard drive
diagnostic data, input and output stats, hardware temperatures, network
connections, CPU usage, and RAM usage. As you can see, Linux has no shortage of
tools to let us monitor our system for problems. It is necessary for all system
administrators to run these and similar commands on a regular basis in order to
maintain a healthy system.
Related Linux Tutorials:
• An Introduction to Linux Automation, Tools and Techniques
• How to monitor network activity on a Linux system
• Linux Performance Optimization: Tools and Techniques
• Linux Con�guration �les: Top 30 most important
• Mastering Bash Script Loops
• How to partition USB drive in Linux
• How to partition a drive on Linux
• Things to do a�er installing Ubuntu 22.04 Jammy Jelly�sh…
• Linux Download
• Can Linux Get Viruses? Exploring the Vulnerability of Linux…
System Administration
administration, beginner, commands, server
9 of 13 4/7/23, 12:33 PM
Linux basic health check commands - Linux Tutorials - ... https://linuxconfig.org/linux-basic-health-check-commands
How to set �lesystems mount order on modern Linux distributions
Get CPU temperature on Linux
Comments and Discussions
Start Discussion 0 replies
NEWSLETTER
Subscribe to Linux Career Newsletter to receive latest news, jobs, career advice and featured
con�guration tutorials.
SUBSCRIBE
WRITE FOR US
LinuxCon�g is looking for a technical writer(s) geared towards GNU/Linux and FLOSS
technologies. Your articles will feature various GNU/Linux con�guration tutorials and FLOSS
technologies used in combination with GNU/Linux operating system.
When writing your articles you will be expected to be able to keep up with a technological
advancement regarding the above mentioned technical area of expertise. You will work
independently and be able to produce at minimum 2 technical articles a month.
APPLY NOW
10 of 13 4/7/23, 12:33 PM
Linux basic health check commands - Linux Tutorials - ... https://linuxconfig.org/linux-basic-health-check-commands
TAGS
18.04 administration apache applications backup bash beginner browser
centos centos8 commands database debian desktop development docker error
fedora �lesystem �rewall gaming gnome Hardware installation java kali manjaro
multimedia networking nvidia programming python redhat rhel8 scripting
security server ssh storage terminal ubuntu ubuntu 20.04 virtualization webapp
webserver
ABOUT US
FEATURED TUTORIALS
VIM tutorial for beginners
How to install the NVIDIA drivers on Ubuntu 20.04 Focal Fossa Linux
Bash Scripting Tutorial for Beginners
How to check CentOS version
How to �nd my IP address on Ubuntu 20.04 Focal Fossa Linux
Ubuntu 20.04 Remote Desktop Access from Windows 10
Howto mount USB drive in Linux
How to install missing ifcon�g command on Debian Linux
AMD Radeon Ubuntu 20.04 Driver Installation
Ubuntu Static IP con�guration
How to use bash array in a shell script
Linux IP forwarding – How to Disable/Enable
How to install Tweak Tool on Ubuntu 20.04 LTS Focal Fossa Linux
11 of 13 4/7/23, 12:33 PM
Linux basic health check commands - Linux Tutorials - ... https://linuxconfig.org/linux-basic-health-check-commands
How to enable/disable �rewall on Ubuntu 18.04 Bionic Beaver Linux
Netplan static IP on Ubuntu con�guration
How to change from default to alternative Python version on Debian Linux
Set Kali root password and enable root login
How to Install Adobe Acrobat Reader on Ubuntu 20.04 Focal Fossa Linux
How to install the NVIDIA drivers on Ubuntu 18.04 Bionic Beaver Linux
How to check NVIDIA driver version on your Linux system
Nvidia RTX 3080 Ethereum Hashrate and Mining Overclock settings on HiveOS Linux
LATEST TUTORIALS
Introduction to Vagrant
Check CPU and RAM usage of a Kubernetes pod
Kubernetes vs Docker, whatʼs the di�erence?
Install and Use MicroK8s on Ubuntu
How to Create and Manage a Pod in Kubernetes
How to Create, Manage, and Expose a Service in Kubernetes
Control CPU and RAM usage in Kubernetes
How to Setup Minikube for Kubernetes
Choosing a Kubernetes Networking Addon
What is Kubernetes used for?
How to create a cron job in Kubernetes
kubeadm vs minikube, pros and cons
How to Create a Kubernetes Cluster
How to use helm package manager for Kubernetes
How to deploy WordPress on a Kubernetes cluster
kubectl command examples (cheat sheet)
How to manage and troubleshoot Kubernetes logs
How to Install Kubernetes on All Linux Distros
12 of 13 4/7/23, 12:33 PM
Linux basic health check commands - Linux Tutorials - ... https://linuxconfig.org/linux-basic-health-check-commands
How to Manage Kubernetes Clusters With kubectl
How to Deploy an Application in Kubernetes
© 2023 TOSID Group Pty Ltd - LinuxCon�g.org
13 of 13 4/7/23, 12:33 PM