You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
System administration covers the day-to-day tasks of maintaining a Linux system — managing disks, monitoring performance, reviewing logs, and securely connecting to remote servers. This lesson brings together the essential tools and practices.
df -h # show filesystem disk usage (human-readable)
df -h / # show usage for a specific mount point
du -sh /var/log # show total size of a directory
du -sh /home/* # show size of each user's home directory
du -h --max-depth=1 /var # show size of immediate subdirectories
lsblk # list block devices (disks and partitions)
lsblk -f # include filesystem information
sudo fdisk -l # detailed partition information
blkid # show UUID and filesystem type
Example lsblk output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├── sda1 8:1 0 512M 0 part /boot/efi
├── sda2 8:2 0 95G 0 part /
└── sda3 8:3 0 4.5G 0 part [SWAP]
sdb 8:16 0 50G 0 disk
└── sdb1 8:17 0 50G 0 part /data
sudo mount /dev/sdb1 /mnt/data # mount a partition
sudo umount /mnt/data # unmount
sudo mount -t ext4 /dev/sdb1 /mnt/data # specify filesystem type
# /etc/fstab
# <device> <mount> <type> <options> <dump> <pass>
UUID=abcd-1234-5678 /data ext4 defaults 0 2
UUID=efgh-9012-3456 /backup xfs defaults,noatime 0 2
sudo mount -a # mount all entries in /etc/fstab
sudo mkfs.ext4 /dev/sdb1 # format as ext4
sudo mkfs.xfs /dev/sdb1 # format as XFS
free -h # show memory and swap usage
sudo swapon --show # show active swap devices
sudo fallocate -l 4G /swapfile # create a 4 GB swap file
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Add to /etc/fstab for persistence:
# /swapfile none swap sw 0 0
uname -a # kernel version, architecture
hostnamectl # hostname and OS info
uptime # uptime and load average
lscpu # CPU information
free -h # memory and swap usage
cat /etc/os-release # distribution information
The load average shows how many processes are waiting for CPU over 1, 5, and 15 minutes:
$ uptime
10:30:00 up 42 days, 3:15, 2 users, load average: 0.50, 0.75, 1.20
| Load Average | Interpretation (single-core) |
|---|---|
| 0.0 – 0.7 | Healthy |
| 0.7 – 1.0 | Starting to saturate |
| > 1.0 | Overloaded (processes queuing) |
Tip: For multi-core systems, divide the load by the number of CPU cores. A load of 4.0 on a 4-core system is equivalent to a load of 1.0 on a single core.
| Tool | Purpose | Install |
|---|---|---|
top / htop | Process monitoring | htop: sudo apt install htop |
vmstat | Virtual memory statistics | Pre-installed |
iostat | Disk I/O statistics | sudo apt install sysstat |
sar | System Activity Reporter | sudo apt install sysstat |
nmon | Comprehensive monitoring | sudo apt install nmon |
dstat | Versatile resource statistics | sudo apt install dstat |
iotop | I/O monitoring by process | sudo apt install iotop |
vmstat 1 5 # report every 1 second, 5 times
iostat -x 1 # extended disk stats every second
sar -u 1 5 # CPU usage every 1 second, 5 reports
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.