Introduction

I’ve started following the Linux Upskill Challenge to sharpen my Linux knowledge and hands-on skills. It’s a series of 21 lessons designed to be completed daily, but I’ll be going through them at my own pace. I’ll share my journey and notes here as I move forward.


Day 1 - Get to know your server


General Information

I connected to my Linux server in the cloud and ran the following commands:

  • lsb_release -a: Shows which Linux distribution and version is installed.
  • cat /etc/os-release: Another way to check the distro—just look at the contents of this file.
  • uname -a: Prints system information like kernel version and hardware platform.
  • uptime: Displays how long the server has been running since the last restart or shutdown.
  • cat /proc/uptime: Another way to check system uptime.
  • whoami: Shows the current user.
  • who: Lists all logged-in users.
  • w: Shows what logged-in users are doing.

Hardware Information

  • lshw: Displays detailed hardware info.
  • lscpu: Shows CPU information.
  • lscpu | grep Hypervisor: Shows which hypervisor your VM is using—my EC2 instance uses Xen.
  • lsblk: Lists storage devices and their partitions. This command led me to start reading about the 20250429T1748 snap package manager.
  • lspci: Lists all PCI devices. These are emulated by the Xen hypervisor, and some are quite outdated.
  • lsusb: Lists USB devices—my EC2 instance shows none, as expected.

Measuring Memory and CPU Usage

  • free -h: Displays memory usage in a human-readable format.
  • vmstat: Gives a snapshot of system performance (CPU, memory, I/O, etc.). Use vmstat 1 for continuous output.
  • top: Real-time summary of system resource usage.
  • htop: A more interactive, colorful version of top.

Measuring Disk Usage

  • df -h: Shows disk space usage in human-readable format.
  • du -h: Shows the size of directories and subdirectories (including hidden ones).
  • sudo du -h --max-depth=1 /: Useful for checking the largest folders under /.

Measuring Network Usage

  • ifconfig: Lists network interfaces and IPs (deprecated, but pre-installed). My EC2 instance shows two: enX0 and lo (loopback).
  • ip address: The modern replacement for ifconfig.
  • netstat -i: Displays interface statistics. It’s deprecated in Ubuntu 24.04.2 LTS and not available by default. I installed it using:
    sudo apt install net-tools -y
  • ifstat: Live bandwidth usage per interface. Not installed by default—installed with:
    sudo apt install ifstat
  • nload: A real-time visual network monitor.
  • sudo iftop -i enX0: Shows live connections, traffic direction, and throughput (like top, but for the network).

Extra: Modern Replacements for netstat

Old netstat CommandModern AlternativePurpose
netstat -iip -s linkInterface stats
netstat -tulnss -tulnListening ports (TCP/UDP)
netstat -rnip route showRouting table
netstat -ass -aAll sockets
netstat -plntss -plntListening TCP ports + PID

Additional Readings