System Monitoring and Troubleshooting

Last Updated: 2024-01-21


Show running processes, memory/cpu usage. Similar to Task Manager in Windows.


Show how long it is been running, and load average.

$ uptime
 10:11:46 up 7 days, 17:02,  1 user,  load average: 1.79, 1.86, 1.79

Get CPU infoy:

$ cat /proc/cpuinfo

CPU count

$ grep -c ^processor /proc/cpuinfo
$ python -c "import os; print(os.cpu_count())"


Check free memory (-h for Human-readable`)

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           5.7G        3.8G        457M         74M        1.5G        1.5G
Swap:          5.9G        102M        5.8G

$ free -m uses MiB as unit.

Check /proc/meminfo

$ cat /proc/meminfo
MemTotal:       xxxx kB
MemFree:        xxxx kB

Show sum of memory usage

$ ps aux | awk '{sum +=$4}; END {print sum}'

Virtual memory stats:

$ vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0 105052 385116 114148 1433576    0    1    13   129  145    6 23 25 52  0  0


Use lsblk:

$ lsblk

To show filesystem type: lsblk -f.

List mounted file systems and usage (-h for "human-readable")

$ df -h
$ df -Th

du can be used to estimate file space usage.

$ du -d1    # depth 1
$ du -s     # sum
$ du -h     # human-readable

Check Partitions

$ cat /proc/partitions

Check /sys/block

$ cat /sys/block/dm-0/queue/rotational
  • RO=0 SSD
  • RO=1 HDD

Processes: ps and pstree

Show processes

$ ps

List processes has "cron" in their names:

$ ps aux | grep -i cron

ps -aux means show all processes for all users.

Show the forest of processes:

$ ps aux --forest

Show in tree view

$ pstree


Read more: Linux Networking


  • lsusb: lists attached USB devices
  • lspci: lists PCI devices
  • lshw: list hardware
  • dmidecode: lists BIOS and other hardware

OS / Software / Env

Linux Kernel and Distro

Check Linux Kernel version

$ uname -r
$ cat /proc/sys/kernel/osrelease

Check Linux distro name and version:

$ lsb_release -a
$ cat /etc/os-release
$ cat /etc/issue

Check GNOME version:

$ cat /usr/share/gnome/gnome-version.xml
$ gnome-shell --version

Check current desktop environment:


Check if You are Using Wayland or Xorg?

# if using Wayland

# if using x11

# if tty

Print platform info

$ python -m platform

Check Runlevel

$ who -r
$ runlevel

List loaded modules

$ lsmod

Check Shell

Check default shell:

$ echo $SHELL

Check current shell:

$ echo $0

Use ps:

$ ps -p $$
    PID TTY          TIME CMD
   6554 pts/0    00:00:00 bash


Per user limit

Check limits

$ ulimit -a

Check limits by PID

$ cat /proc/<pid>/limits

Set limits

$ ulimit -n 64000 -u 64000
  • nofile: number of open files
  • nproc: number of processes

Check if your Linux system is physical or virtual machine

$ dmidecode -s system-manufacturer
VMware, Inc.

$ dmidecode | grep Product

$ hostnamectl status
 Chassis: vm

Control Groups

  • systemd-cgls: Recursively show control group contents