Skip to main content

Monitoring & Management

Description Commands
Daily monitoring top, htop, ps, free, uptime, dmesg
Performance troubleshooting iostat, vmstat, sar, dstat, iotop, mpstat
Hardware/system info lsblk, lshw, lsusb, dmidecode, uname
Logs & users journalctl, w, logrotate, swatch

Daily Drivers

top

Usage       : top
Example     : Run top and press M to sort by memory.
Description : Real-time view of processes, CPU, memory usage.
Takeaway    : Use when you need a quick live snapshot of system performance.

htop

Usage       : htop
Example     : Scroll and kill a process directly from the interface.
Description : Interactive, colorful version of top with easier navigation.
Takeaway    : Use when you want a user-friendly, interactive process monitor.

ps

Usage       : ps aux | grep nginx
Example     : Find all processes owned by a user: ps -u shubham
Description : Lists running processes with detailed info.
Takeaway    : Use for static process snapshots and filtering.

free

Usage       : free -h
Example     : free -m shows memory in MB.
Description : Displays memory usage (RAM + swap).
Takeaway    : Use to quickly check memory availability and swap usage.

uptime

Usage       : uptime
Example     : uptime -p → “up 3 hours, 20 minutes”
Description : Shows system uptime and load averages.
Takeaway    : Use to check how long the system has been running and current load.

dmesg

Usage       : dmesg | grep error
Example     : Check USB device logs: dmesg | grep usb
Description : Kernel ring buffer messages (hardware, drivers, boot logs).
Takeaway    : Use for troubleshooting hardware or kernel-related issues.

lsof

Usage       : lsof -i :80
Example     : Find which process is using port 22: lsof -i :22
Description : Lists open files and network sockets.
Takeaway    : Use to debug file locks or network port usage.

lsblk

Usage       : lsblk
Example     : lsblk -f shows filesystem info.
Description : Lists block devices (disks, partitions).
Takeaway    : Use to understand disk layout and mounted partitions.

iostat

Usage       : iostat -xz 1
Example     : Monitor disk performance in real-time.
Description : CPU and I/O statistics.
Takeaway    : Use for diagnosing disk bottlenecks.

vmstat

Usage       : vmstat 2 5
Example     : Monitor every 2 seconds, 5 times.
Description : Reports CPU, memory, I/O, and process stats.
Takeaway    : Use for overall system health trends.

sar

Usage       : sar -u 1 5
Example     : CPU usage every second for 5 intervals.
Description : Historical system performance metrics.
Takeaway    : Use for long-term performance analysis.

dstat

Usage       : dstat -cdngy
Example     : Show CPU, disk, network, and paging stats.
Description : Versatile real-time resource monitor.
Takeaway    : Use when you want a combined view of multiple resources.

iotop

Usage       : iotop
Example     : Identify which process is hogging disk I/O.
Description : Real-time disk I/O usage per process.
Takeaway    : Use for troubleshooting heavy disk usage.

journalctl

Usage       : journalctl -u nginx
Example     : View logs for a specific service.
Description : Systemd log viewer.
Takeaway    : Use for centralized log analysis on systemd-based systems.

w

Usage       : w
Example     : See who’s logged in and what they’re running.
Description : Shows logged-in users and system load.
Takeaway    : Use for quick user + load monitoring.

uname

Usage       : uname -a
Example     : uname -r shows kernel version.
Description : Displays system info (kernel, architecture).
Takeaway    : Use to check system/kernel details.

procinfo

Usage       : procinfo
Example     : Displays CPU, memory, and uptime.
Description : Summarizes system info from /proc.
Takeaway    : Use for a quick /proc overview.

lshw

Usage       : sudo lshw
Example     : sudo lshw -short
Description : Detailed hardware info.
Takeaway    : Use for hardware inventory.

date

Usage       : date +"%Y-%m-%d %H:%M:%S"
Example     : Format output for logs.
Description : Displays/sets system date/time.
Takeaway    : Use for time-related scripting.

time

Usage       : time ls
Example     : Shows real/user/sys time.
Description : Measures command execution time.
Takeaway    : Use for performance benchmarking.

watch

Usage       : watch -n 2 df -h
Example     : Monitor disk usage every 2 seconds.
Description : Runs a command repeatedly.
Takeaway    : Use for continuous monitoring.

cal

Usage       : cal 2025
Example     : Show full year calendar.
Description : Displays calendar.
Takeaway    : Use for quick date references.

System Management

  • adduser / chpasswd / chage / grpck / login / logout / exit / vlock → User & session management.
  • shutdown / halt / reboot / suspend → Power management.
  • logrotate / swatch / journalctl → Log management.
  • rlogin / rsh / sliplogin / rwho → Legacy remote login tools (rarely used today).
  • logname → Current user login name.

Tips, Tricks, Roadmaps, Resources, Networking, Motivation, Guidance, and Cool Stuff ♥

Updated on Dec 23, 2025