10 System Information

Learning objectives

  • Inspect system version, hostname, and uptime.
  • Inspect CPU, memory, disk space, and block devices.
  • Make a quick judgment about resource pressure.

Command overview

CommandPurposeMeaningBasic usageExample
unameView kernel informationUnix name; shows kernel and architecture informationuname [options]uname -a
hostnameView or set hostnameShows the current machine namehostnamehostname
uptimeView uptime and loadShows uptime, user count, and load averageuptimeuptime
dateView or set timeShows current date and timedatedate
freeView memoryShows memory and swap usefree [options]free -h
dfView disk spaceDisk free; shows filesystem free spacedf [options]df -h
duView directory useDisk usage; totals file or directory sizedu [options] pathdu -sh -- .
lsblkView block devicesList block devices; lists disks and partitionslsblklsblk
lscpuView CPU informationList CPU; shows CPU architecture and core countlscpulscpu

Common scenarios

Show system and host information:

uname -a
hostname
date
uptime

View memory:

free -h

View disk space:

df -h
df -ih

View item sizes in the current directory:

du -sh -- ./*

View disks and CPU:

lsblk
lscpu

Notes for beginners

  • -h commonly means human-readable sizes in KB, MB, and GB.
  • df -h shows filesystem free space; du -sh shows actual directory use.
  • df -i shows inodes. Having free capacity does not prove you can create another file.
  • du -sh -- ./* excludes hidden entries and can be slow in a large directory containing many files; a script must state its scan scope.
  • Interpret uptime load average with the CPU core count; it is not a simple percentage.
  • lsblk only displays devices and partitions. Do not casually format or mount disks.
  • free, ps, and uptime commonly come from procps-ng; lsblk and lscpu from util-linux. Minimal containers and macOS/BSD can lack them.
  • Linux commonly uses free memory as cache. For troubleshooting, focus on available, swap, and sustained trends rather than the free column alone.
  • In a container, commands can show different namespace, cgroup, or host views. Do not automatically interpret output as the container limit.

Read-only resource-evidence exercise

uname -srm
uptime
free -h
df -h -- .
df -ih -- .
du -sh -- .
lscpu | sed -n '1,12p'

A report must distinguish a momentary snapshot, trend, and unknowns. Do not claim a root cause from one load or memory output.

References