Linux
    Overview
    Process
    Sockets
    File
    File System Hierarchy
    System Calls
    Libraries
    Device
    systemd
    Service
    namespaces
    Memory
    Modules
    Signals
    System Monitoring
    Desktop Environment
    Users and Groups
    Logs
    Network
    Terminal
    GNU

System Monitoring

Updated: 2022-08-06

top

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

CPU: uptime

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

Memory: free

Check free memory

$ free
              total        used        free      shared  buff/cache   available
Mem:        5967380     3951608      469008       76044     1546764     1588088
Swap:       6146044      105052     6040992

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.

Disk: df / du

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

$ df -h

du can be used to estimate file space usage.

vmstat

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

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 in tree view

$ pstree

tcpdump

$ sudo tcpdump

Network

There are top-like tool for network, but need to be installed separately, e.g. iftop

Hardware

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