Operations 11 min read

Essential Linux Commands for Monitoring System Health

This guide introduces key Linux commands—such as uptime, who, uname, du, df, free, pmap, vmstat, ifconfig, ip, netstat, top, and pstree—to help you quickly assess system status, resource usage, and process relationships, enabling effective troubleshooting and maintenance.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Essential Linux Commands for Monitoring System Health

Viewing system uptime and load – uptime

The uptime command shows the current time, how long the system has been running, the number of logged‑in users, and the 1‑, 5‑, and 15‑minute load averages. uptime Typical output: 20:47:06 up 50 min, 1 user, load average: 0.75, 0.84, 0.93. The fields from left to right are current time, uptime, user count, and the three load averages.

Listing logged‑in users – who -a

who -a

displays each user, the terminal they are using, login time, and originating IP address.

who -a

Checking OS and kernel details – uname -a

uname -a

prints the operating system name, kernel version, hardware architecture, and other system information. uname -a Example output reveals Ubuntu 16.04, x86_64 architecture, and kernel build details.

Viewing environment variables – export

Running export without arguments lists all current environment variables, which can affect program behavior.

export

Inspecting directory and file sizes – du -h --max-depth=1

The du command reports disk usage for each subdirectory. The -h flag makes sizes human‑readable, and --max-depth=1 limits the output to the immediate children of the current directory. du -h --max-depth=1 Adding du -sh shows only the total size of the current directory.

Displaying mounted filesystems – df -h

df -h

lists each mounted filesystem, its total capacity, used space, available space, usage percentage, and mount point. df -h This information helps identify disks that are near full capacity and may need cleaning.

Checking memory usage – free -h

The free command shows total, used, and free physical memory, as well as swap usage and buffers/cache. free -h High memory consumption can cause system slowdowns or application failures.

Examining a process's memory map – pmap <pid>

pmap

displays the memory regions used by a specific process, identified by its PID (obtainable via ps). pmap 6030 Analyzing the output helps optimise a program's memory footprint.

Viewing virtual memory statistics – vmstat

vmstat

provides a snapshot of system performance, including processes, memory, swap, I/O, and CPU usage. vmstat Values such as high si / so indicate swap activity, while a high us percentage shows CPU time spent in user space.

Getting the external IP address – curl ifconfig.me

Use curl ifconfig.me to retrieve the public IP address of the host.

curl ifconfig.me

Inspecting network interfaces – ifconfig -a

ifconfig -a

lists all network interfaces, their IP addresses, and other details.

ifconfig -a

Showing IP addresses – ip addr

The modern ip addr command provides comprehensive interface and address information, often more complete than ifconfig.

ip addr

Checking network connections – netstat

netstat

displays active network connections, listening ports, and routing tables, useful for diagnosing network issues.

netstat -tulnp

Monitoring CPU and memory usage – top

The interactive top utility shows real‑time CPU load, memory consumption, running tasks, and per‑process statistics.

top

Viewing process hierarchy – pstree

pstree

prints a tree view of processes, revealing parent‑child relationships.

pstree

Dynamic monitoring with watch

Combine watch with other commands to refresh output at regular intervals, e.g., every second.

watch -n 1 cat /proc/meminfo
watch -n 1 cat /proc/net/dev

This allows continuous observation of memory or network statistics.

Conclusion

These built‑in Linux commands provide a quick and effective way to monitor system health, diagnose problems, and maintain performance. For deeper details, consult the corresponding manual pages with man <command>.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxsystem-monitoringtopFreenetstatduuptimedfpmap
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.