Menu Close

Linux Tutorial

Linux Tutorial

Linux is an open-source, Unix-like operating system used in personal computers, servers, cloud infrastructure, and embedded devices. Its flexible design, extensive development tools, and powerful command-line environment make it useful for programming, networking, automation, and system administration.

At the center of a Linux system is the kernel, which manages CPU time, memory, hardware devices, and other system resources. A Linux distribution, such as Ubuntu, Debian, or Fedora, combines the kernel with libraries, utilities, and applications to provide a complete operating system.

This Linux tutorial connects practical commands with the concepts behind them. Start with the fundamentals, practice in a terminal, and gradually build the skills needed to understand and manage a Linux system.

Getting Started

Understand how Linux fits together and prepare an environment for practice.

  • What Is Linux?
  • Linux, GNU, and Unix
  • Linux Architecture: Kernel and User Space
  • Understanding Linux Distributions
  • Running Linux in a Virtual Machine or WSL
  • Your First Terminal Session

Working with Files

Learn how Linux organizes data and how to work confidently with files.

  • The Root Directory and Directory Structure
  • Absolute and Relative Paths
  • Creating, Copying, Moving, and Deleting Files
  • Reading and Editing Text
  • Finding Files and Searching Their Contents
  • Links, Archives, and Compression

Using the Shell

Build commands that work together and automate everyday tasks.

  • Commands, Arguments, and Options
  • Standard Input, Output, and Errors
  • Redirection and Pipes
  • Variables, Quoting, and Wildcards
  • Writing Basic Bash Scripts

Managing a Linux System

Explore the tools and responsibilities involved in system administration.

  • Users, Groups, Ownership, and Permissions
  • Administrative Access with sudo
  • Installing and Updating Software
  • Processes and Background Jobs
  • Booting, Services, and Logs
  • Storage, Memory, and CPU Monitoring

Connecting and Troubleshooting

Apply Linux skills to communication, remote access, and problem solving.

  • IP Addresses, Routes, and DNS
  • Testing Network Connections
  • Remote Access with SSH
  • Transferring Files Securely
  • Firewall Fundamentals
  • Diagnosing Common System Problems

No previous Linux experience is required. Basic computer knowledge is enough to begin. Practice the examples in a Linux environment, and check explanations for commands before running them with administrative privileges.

Linux Tutorial: From Fundamentals to System Administration

Linux powers web servers, cloud platforms, development environments, network appliances, and embedded systems. Learning Linux means understanding both the commands you use and the operating system behind them: how programs run, how files are organized, how access is controlled, and how services communicate across a network.

Strictly speaking, Linux is the kernel—the component that manages CPU time, memory, devices, and other system resources. A Linux distribution combines this kernel with libraries, command-line utilities, system services, package management tools, and applications to form a complete operating system.

This tutorial provides a structured path from Linux fundamentals to practical system administration. It covers filesystems, permissions, software installation, networking, security, process management, shell scripting, and cloud deployments. Beginners can follow the sections in order, while experienced users can go directly to a particular topic.

Linux Fundamentals

Understand the main components of a Linux system and how they work together.

  • What Is Linux?
  • The History of Unix and Linux
  • Linux, GNU, and GNU/Linux
  • Open-Source Software and Software Licenses
  • Linux vs. Unix
  • Linux vs. Windows
  • Linux Architecture: Hardware, Kernel, Libraries, and Applications
  • Kernel Space and User Space
  • System Calls and Device Drivers
  • Linux Distributions and Distribution Families
  • Desktop Linux, Server Linux, and Embedded Linux
  • Fixed Releases, Rolling Releases, and Long-Term Support
  • Understanding the Linux Documentation: man, info, and Help Options

Installing Linux and Preparing Your Environment

Set up a Linux environment and learn the basic steps involved in installation and initial configuration.

  • Choosing a Linux Distribution
  • Understanding Installation Images and Bootable Media
  • Installing Linux in a Virtual Machine
  • Using Linux Through Windows Subsystem for Linux
  • Installing Linux on a Physical Computer
  • Understanding UEFI, Bootloaders, and Secure Boot
  • Planning Partitions and Filesystems
  • Understanding Swap Partitions and Swap Files
  • Creating Your First User Account
  • Updating a Newly Installed System
  • Checking Distribution and Kernel Information
  • Using Virtual Machine Snapshots for Practice

The Terminal and Command Line

Learn how to enter commands, read their output, and find help.

  • Terminal, Console, Shell, and Kernel: What Is the Difference?
  • Understanding the Command Prompt
  • Commands, Arguments, and Options
  • Getting Help with man, help, and –help
  • Command History and Tab Completion
  • Understanding PATH and Command Lookup
  • Aliases, Shell Functions, and Executable Files
  • Standard Input, Standard Output, and Standard Error
  • Redirecting Input and Output
  • Connecting Commands with Pipes
  • Command Exit Status
  • Quoting, Escaping, and Wildcards
  • Running Multiple Commands Conditionally

Linux Filesystems and Directory Structure

Understand how Linux organizes files, storage devices, and mounted filesystems.

  • The Linux Filesystem Hierarchy
  • The Root Directory: /
  • Understanding /home, /root, /etc, /var, /usr, and /tmp
  • Understanding /dev, /proc, /sys, and /run
  • Absolute and Relative Paths
  • File Types and Hidden Files
  • Case Sensitivity and File Naming
  • Inodes and File Metadata
  • Hard Links and Symbolic Links
  • Filesystems, Partitions, and Mount Points
  • Common Linux Filesystems: ext4, XFS, and Btrfs
  • Understanding Filesystem UUIDs
  • Mounting and Unmounting Filesystems
  • Persistent Mounts with /etc/fstab

File and Directory Management

Practice everyday operations for creating, organizing, inspecting, and finding files.

  • Navigating with pwd, ls, and cd
  • Creating Directories with mkdir
  • Creating Files with touch
  • Copying Files and Directories with cp
  • Moving and Renaming Files with mv
  • Removing Files and Directories with rm and rmdir
  • Identifying File Types with file
  • Inspecting Metadata with stat
  • Reading Files with cat, less, head, and tail
  • Finding Files with find and locate
  • Comparing Files with diff and cmp
  • Synchronizing Directories with rsync
  • Working with Filenames Containing Spaces and Special Characters

Text Editing and Text Processing

Use Linux tools to edit configuration files, search logs, and transform text.

  • Editing Text with Nano
  • Vim Fundamentals: Modes, Navigation, Saving, and Quitting
  • Searching Text with grep
  • Basic and Extended Regular Expressions
  • Sorting and Removing Duplicate Lines with sort and uniq
  • Selecting Fields with cut
  • Translating Characters with tr
  • Counting Lines, Words, and Bytes with wc
  • Combining Data with paste and join
  • Stream Editing with sed
  • Processing Structured Text with awk
  • Building Text-Processing Pipelines
  • Handling Command Arguments with xargs
  • Working with JSON Using jq

File Permissions and Access Control

Learn how Linux controls access to files, directories, and administrative operations.

  • Users, Groups, and File Ownership
  • Read, Write, and Execute Permissions
  • How Directory Permissions Differ from File Permissions
  • Reading Permission Information with ls -l
  • Changing Permissions with chmod
  • Symbolic and Numeric Permission Modes
  • Changing Ownership with chown and chgrp
  • Default Permissions and umask
  • The Sticky Bit, Setgid, and Setuid
  • Access Control Lists with getfacl and setfacl
  • Administrative Access with sudo
  • Editing sudo Rules with visudo
  • Linux Capabilities
  • Introduction to SELinux and AppArmor
  • Diagnosing Permission Denied Errors

Archiving and Compressing

Understand the difference between collecting files into an archive and compressing data to reduce its size.

  • Archiving vs. Compression
  • Creating and Extracting Archives with tar
  • Listing and Extracting Selected Archive Members
  • Compressing Files with gzip
  • Decompressing Files with gunzip
  • Using bzip2 and xz
  • Using Zstandard with zstd
  • Creating and Extracting ZIP Archives
  • Preserving Permissions and Ownership in Archives
  • Excluding Files from an Archive
  • Verifying File Integrity with Checksums
  • Safely Inspecting Archives Before Extraction
  • Choosing an Archive Format for Backups and Transfers

Package Management

Learn how distributions install, update, verify, and remove software.

  • Packages, Repositories, Dependencies, and Metadata
  • Binary Packages and Source Packages
  • Package Signatures and Repository Trust
  • Updating Package Lists vs. Upgrading Installed Software
  • Managing Software with APT
  • Inspecting Debian Packages with dpkg
  • Managing Software with DNF
  • Inspecting RPM Packages with rpm
  • Managing Software with pacman
  • Managing Software with Zypper
  • Finding Which Package Owns a File
  • Viewing Package Versions and Dependencies
  • Removing Packages and Unused Dependencies
  • Understanding Configuration Files During Upgrades
  • Flatpak, Snap, and AppImage
  • Installing Software from Source
  • Troubleshooting Package Conflicts and Failed Updates
  • Planning Security Updates and System Upgrades

User and Group Management

Manage user identities, group membership, authentication, and administrative access.

  • User IDs and Group IDs
  • Understanding /etc/passwd, /etc/shadow, and /etc/group
  • Creating Users with useradd and adduser
  • Modifying Users with usermod
  • Removing Users with userdel
  • Creating and Managing Groups
  • Primary and Supplementary Groups
  • Checking Identity with id and groups
  • Setting and Changing Passwords
  • Password Aging and Account Expiration
  • Locking and Unlocking Accounts
  • Login Shells and Home Directories
  • System Accounts and Service Accounts
  • Switching Users with su and sudo
  • Delegating Administrative Privileges
  • Introduction to PAM Authentication
  • Reviewing Login Activity and Account Access

Process Management

Understand how Linux runs programs and how to inspect, control, and troubleshoot them.

  • Programs, Processes, and Threads
  • Process IDs and Parent Process IDs
  • Process Creation and Program Execution
  • Process States
  • Viewing Processes with ps and pgrep
  • Monitoring Processes with top and htop
  • Sending Signals with kill and pkill
  • SIGTERM vs. SIGKILL
  • Foreground and Background Jobs
  • Job Control with jobs, bg, and fg
  • Keeping Commands Running with nohup
  • Persistent Terminal Sessions with tmux
  • Process Priorities with nice and renice
  • CPU Affinity with taskset
  • Resource Limits with ulimit
  • Understanding Zombie and Orphan Processes
  • Introduction to Control Groups
  • Diagnosing High CPU and Memory Usage

Boot Process, System Services, and Scheduling

Follow the path from system startup to running services, then automate scheduled work.

  • From Firmware to the Linux Kernel
  • Bootloaders and GRUB
  • The Initial RAM Filesystem
  • The First User-Space Process and PID 1
  • Init Systems and systemd
  • Understanding systemd Units and Targets
  • Starting, Stopping, and Restarting Services
  • Enabling Services at Boot
  • Viewing Service Status and Dependencies
  • Creating a Basic systemd Service
  • Overriding Service Settings
  • Reading Logs with journalctl
  • Scheduling Tasks with cron
  • Managing Personal Cron Jobs with crontab
  • Scheduling One-Time Tasks with at
  • Scheduling Tasks with systemd Timers
  • Troubleshooting Failed Services and Boot Problems

Storage and Disk Administration

Manage block devices, filesystems, capacity, and storage health.

  • Identifying Devices with lsblk and blkid
  • Inspecting Partition Tables
  • GPT and MBR Partitioning
  • Creating Partitions with fdisk and parted
  • Creating Filesystems with mkfs
  • Checking Space with df and du
  • Understanding Disk Space vs. Inode Exhaustion
  • Managing Swap
  • Logical Volume Management Fundamentals
  • Creating and Extending Logical Volumes
  • Filesystem Growth and Shrinking Limitations
  • Introduction to Linux Software RAID
  • Disk Encryption with LUKS
  • Monitoring Drive Health with SMART Tools
  • SSD Discard and fstrim
  • Filesystem Checks and Recovery Considerations
  • Diagnosing Read-Only Filesystems and Storage Errors

Linux Networking

Understand how a Linux system communicates with local devices, remote servers, and the internet.

Networking Fundamentals

  • Network Interfaces and Interface Names
  • MAC Addresses and Ethernet
  • IPv4 and IPv6
  • Subnets and CIDR Notation
  • Private and Public IP Addresses
  • Default Gateways and Routing Tables
  • TCP, UDP, Ports, and Sockets
  • Loopback Addresses and localhost
  • ARP and IPv6 Neighbor Discovery
  • Hostnames and Name Resolution

Network Configuration and Commands

  • Viewing Interfaces and Addresses with ip
  • Managing Routes with ip route
  • Inspecting Neighbor Entries with ip neigh
  • Managing Connections with NetworkManager and nmcli
  • Understanding systemd-networkd
  • Understanding Netplan
  • Configuring Static and Dynamic Addresses
  • Configuring DNS Resolution
  • Viewing Listening Ports with ss
  • Testing HTTP Services with curl
  • Downloading Files with curl and wget
  • Understanding Bridges, Bonds, and VLANs
  • Introduction to Network Namespaces

Networking Services

  • DHCP: Automatic Network Configuration
  • DNS: Names, Records, Caching, and Resolution
  • SSH: Secure Remote Administration
  • SFTP and SCP: Secure File Transfer
  • HTTP and HTTPS Services
  • Nginx and Apache Fundamentals
  • NFS File Sharing
  • Samba and SMB File Sharing
  • Time Synchronization with NTP and Chrony
  • Email Service Fundamentals: SMTP, IMAP, and POP3
  • Proxy Servers and Reverse Proxies
  • VPN Fundamentals
  • Understanding FTP and Its Security Limitations

Linux Firewall

  • Host Firewalls and Network Firewalls
  • Netfilter and Packet Filtering
  • Stateful Filtering and Connection Tracking
  • Input, Output, and Forwarded Traffic
  • Introduction to nftables
  • Understanding iptables and Its Backends
  • Managing Firewall Rules with UFW
  • Managing Firewall Zones with firewalld
  • Allowing Specific Services and Source Addresses
  • IPv4 and IPv6 Firewall Coverage
  • Network Address Translation
  • Port Forwarding
  • Firewall Logging and Rule Inspection
  • Preserving SSH Access During Firewall Changes
  • Making Firewall Configuration Persistent

Monitoring and Troubleshooting

  • A Step-by-Step Network Troubleshooting Method
  • Checking Link State and Address Configuration
  • Testing Reachability with ping
  • Tracing Routes with traceroute, tracepath, and mtr
  • Investigating DNS with dig and resolvectl
  • Inspecting Connections and Listening Ports with ss
  • Capturing Packets with tcpdump
  • Analyzing Captures with Wireshark
  • Testing TCP Connections
  • Investigating HTTP Responses and TLS Failures
  • Diagnosing Connection Refused vs. Connection Timeout
  • Checking Firewall and Routing Problems
  • Understanding Packet Loss, Latency, and MTU Issues
  • Troubleshooting DHCP and DNS Failures

Linux Security

Build security into account management, service configuration, remote access, and daily maintenance.

  • Applying the Principle of Least Privilege
  • Reducing Unnecessary Software and Services
  • Managing Security Updates
  • Securing SSH with Public-Key Authentication
  • Protecting Private Keys and Using an SSH Agent
  • Controlling Root and Password-Based Remote Login
  • Restricting Administrative Access
  • Understanding Authentication and Authorization
  • Protecting Secrets and Configuration Files
  • TLS Certificates and Secure Service Configuration
  • SELinux and AppArmor in Practice
  • Recording Security Events with auditd
  • Reviewing Authentication Logs
  • Rate Limiting and Tools Such as Fail2ban
  • File Integrity Monitoring
  • Basic Vulnerability Management
  • Backup Protection and Recovery Planning
  • Responding to a Suspected Compromise

System Monitoring and Performance

Measure system behavior and identify resource bottlenecks.

  • Checking System Information with uname and hostnamectl
  • Understanding Uptime and Load Average
  • Viewing CPU Information with lscpu
  • Understanding Memory Usage with free
  • Buffers, Page Cache, and Available Memory
  • Swap Activity and Memory Pressure
  • Monitoring with vmstat
  • CPU and Storage Statistics with iostat
  • Per-Process Statistics with pidstat
  • Collecting Historical Metrics with sar
  • Inspecting Open Files with lsof
  • Understanding /proc and /sys
  • Recognizing CPU, Memory, Disk, and Network Bottlenecks
  • Understanding the Out-of-Memory Killer
  • Introduction to Pressure Stall Information
  • Establishing Performance Baselines

Logs and System Troubleshooting

Use evidence from logs, configuration, and system state to investigate failures.

  • Understanding /var/log
  • The systemd Journal and Traditional Log Files
  • Filtering Logs by Service, Time, and Priority
  • Reading Kernel Messages with dmesg
  • Managing Log Rotation with logrotate
  • Diagnosing Failed Services
  • Troubleshooting Full Disks and Deleted Open Files
  • Investigating Login Failures
  • Diagnosing Permission and Ownership Problems
  • Troubleshooting Package Installation Failures
  • Checking Configuration Syntax Before Reloading Services
  • Understanding Core Dumps
  • Tracing System Calls with strace
  • Working in Rescue and Emergency Environments
  • Documenting Problems, Changes, and Resolutions

Linux Practical Guides for System Administration

Bring individual concepts together through complete administrative tasks.

  • Prepare a Linux Server After Installation
  • Create an Administrator Account and Configure sudo
  • Configure SSH Key Access
  • Set a Hostname, Time Zone, and Time Synchronization
  • Configure a Static IP Address
  • Set Up a Basic Host Firewall
  • Install and Configure an Nginx Web Server
  • Configure Apache Virtual Hosts
  • Host Multiple Websites on One Server
  • Configure HTTPS for a Website
  • Run an Application as a systemd Service
  • Configure a Reverse Proxy
  • Deploy a Basic Database Service
  • Set Up Shared Directories with Group Permissions
  • Configure NFS or Samba File Sharing
  • Add and Mount a New Data Disk
  • Expand Storage Using LVM
  • Automate Backups with rsync
  • Restore Files and Verify Recovery
  • Schedule Maintenance Tasks
  • Diagnose a Website That Is Not Responding
  • Investigate Unexpected Resource Usage
  • Plan and Perform a Server Migration

Shell Scripting

Turn commands into reusable tools for automation and administration.

Shell Scripting Fundamentals

  • What Is a Shell Script?
  • Bash vs. POSIX sh
  • The Shebang and Script Interpreter
  • Creating and Running a Script
  • Comments and Readable Script Structure
  • Variables and Environment Variables
  • Single Quotes, Double Quotes, and Expansion
  • Reading Input with read
  • Printing Output with printf
  • Command Substitution
  • Positional Parameters and Script Arguments
  • Exit Status and Explicit Exit Codes

Conditions, Loops, and Functions

  • Testing Files, Strings, and Numbers
  • Conditional Logic with if, elif, and else
  • Multiple Choices with case
  • for, while, and until Loops
  • Loop Control with break and continue
  • Defining Functions
  • Function Arguments and Return Status
  • Variable Scope and local
  • Bash Arrays and Associative Arrays
  • Arithmetic Expressions
  • Processing Options with getopts

Reliable Administrative Scripts

  • Handling Filenames and Whitespace Correctly
  • Reading Files Line by Line
  • Quoting Variables Safely
  • Understanding Pipelines and Subshells
  • Using Temporary Files with mktemp
  • Handling Signals and Cleanup with trap
  • Understanding set -e, set -u, and pipefail
  • Recording Logs and Error Messages
  • Preventing Overlapping Runs with flock
  • Debugging with bash -x
  • Checking Scripts with ShellCheck
  • Protecting Credentials and Sensitive Output

Practical Scripting Projects

  • Check Disk Usage and Report Thresholds
  • Verify That a Service Is Running
  • Create Timestamped Backups
  • Validate Backup Results
  • Summarize Authentication Failures
  • Extract Information from Log Files
  • Process a List of Hosts
  • Check Website Availability
  • Generate a Basic System Report
  • Automate Repetitive File Operations

Backup and Recovery

Design backups around successful restoration and the needs of the system.

  • Full, Incremental, and Differential Backups
  • Filesystem Snapshots vs. Independent Backups
  • Recovery Point and Recovery Time Objectives
  • Local, Remote, and Off-Site Backups
  • Preserving Permissions, ACLs, and Extended Attributes
  • File Backups with tar and rsync
  • Introduction to Dedicated Backup Tools
  • Application-Consistent Database Backups
  • Backup Encryption and Access Control
  • Retention Policies and Available Capacity
  • Testing File and System Restores
  • Recovering Configuration and Service Data
  • Writing a Recovery Procedure

Virtualization and Containers

Understand the different ways Linux workloads can share hardware and operating-system resources.

  • Virtual Machines vs. Containers
  • Hypervisors and Hardware Virtualization
  • Introduction to KVM and QEMU
  • Managing Virtual Machines with libvirt
  • Virtual Disks and Virtual Networks
  • Container Images and Running Containers
  • Docker and Podman Fundamentals
  • Container Storage, Volumes, and Bind Mounts
  • Container Networking and Published Ports
  • Rootless Containers
  • Building a Basic Container Image
  • Managing Multiple Services with Compose
  • Resource Limits and Container Logs
  • Container Security Fundamentals
  • Introduction to Kubernetes

Linux Cloud

Apply Linux administration skills to remote infrastructure and cloud workloads.

  • The Role of Linux in Cloud Computing
  • Virtual Machines, Images, and Instance Types
  • Launching and Accessing a Linux Cloud Instance
  • SSH Keys and Cloud Access Management
  • Public and Private Networks
  • Cloud Firewalls and Host Firewalls
  • Block Storage, Object Storage, and Shared Storage
  • Persistent and Ephemeral Data
  • Initial Configuration with cloud-init
  • Instance Metadata and Workload Credentials
  • Deploying a Web Application
  • Reverse Proxies, Load Balancers, and TLS
  • Monitoring, Logs, and Alerts
  • Snapshots, Backups, and Recovery
  • Infrastructure as Code Fundamentals
  • Configuration Management with Ansible
  • Linux in CI/CD Workflows
  • Availability, Scaling, and Operating Costs

Linux Interview Questions

Review the concepts behind common interview questions and practice explaining your reasoning.

Fundamentals and Architecture

  • What is the difference between Linux and a Linux distribution?
  • How do kernel space and user space differ?
  • What happens when a program makes a system call?
  • How are a shell and a terminal different?
  • What happens during the Linux boot process?

Files, Storage, and Permissions

  • What is an inode?
  • How do hard links and symbolic links differ?
  • What do directory read, write, and execute permissions mean?
  • How does umask affect newly created files?
  • Why can df and du report different disk usage?
  • What happens when a filesystem runs out of inodes?

Processes and Performance

  • What is the difference between a process and a thread?
  • What is a zombie process?
  • How do SIGTERM and SIGKILL differ?
  • What does load average measure?
  • Why does Linux use free memory for cache?
  • How would you investigate a slow server?

Networking and Security

  • How would you investigate a failed SSH connection?
  • What is the difference between a listening port and an established connection?
  • How would you troubleshoot a DNS problem?
  • How do host firewall rules and cloud firewall rules interact?
  • How would you investigate repeated authentication failures?
  • What would you check if a service works locally but cannot be reached remotely?

Administration and Automation

  • How do you investigate a failed systemd service?
  • How would you update a production server?
  • What makes a backup useful during an incident?
  • How do you handle errors in a shell script?
  • How would you prevent a scheduled script from running twice simultaneously?
  • How would you migrate a service while limiting downtime?

How to Use This Tutorial

Begin with the fundamentals, terminal, and file-management sections. Then study permissions, package management, users, processes, and services before moving into networking, security, and administration.

Practice commands in a virtual machine, WSL environment, or dedicated test system. Some tasks require a full Linux installation, additional hardware, or a particular distribution. Examples should identify those requirements and explain commands before asking you to change system settings.

The goal is to develop practical judgment: understand what a command changes, verify the result, and use logs and measurements to decide what to do next.