Linux Essentials

2024-12-15

1. What is Linux?

Linux is an operating system kernel created by Linus Torvalds in 1991. Unlike Windows or macOS, it is open-source, meaning anyone can view, modify, and distribute the source code.

Linux distributions (distros) combine the Linux kernel with additional software to form complete systems. Popular ones include:

  • Ubuntu – user-friendly and widely used for servers and desktops
  • Debian – stable and community-driven
  • Fedora – cutting-edge and backed by Red Hat
  • Arch Linux – minimal and highly customizable
  • Kali Linux – specialized for penetration testing and security research

2. Linux Architecture

A typical Linux system consists of the following layers:

  1. Hardware – The physical components (CPU, memory, storage, etc.)
  2. Kernel – The core that interacts with hardware and manages system resources
  3. Shell – The command-line interface that interprets user commands
  4. Utilities & Applications – Software that helps perform specific tasks

3. The Linux File System

Linux follows a hierarchical file system structure. Everything starts from the root (/) directory.

Common directories include:

DirectoryPurpose
/homeContains user files and directories
/etcConfiguration files
/binEssential user commands
/usrUser-installed software
/varVariable data like logs
/tmpTemporary files

You can explore them using the command:

ls /

4. Essential Linux Commands

Here are some of the most frequently used commands:

CommandDescription
pwdShow current working directory
lsList files and directories
cdChange directory
cpCopy files
mvMove or rename files
rmRemove files
catView file content
grepSearch inside files
chmodChange file permissions
sudoRun command as superuser

Example:

sudo apt update && sudo apt upgrade

This updates and upgrades all packages on a Debian-based system.


5. File Permissions

Every file and directory in Linux has three types of permissions:

  • r – read
  • w – write
  • x – execute

These apply to:

  • User (u)
  • Group (g)
  • Others (o)

Example:

chmod 755 script.sh

This gives full permission to the owner, and read/execute to others.


6. Package Management

Different Linux distributions use different package managers:

DistroPackage ManagerExample Command
Ubuntu/DebianAPTsudo apt install nginx
FedoraDNFsudo dnf install nginx
ArchPacmansudo pacman -S nginx

7. Shell Scripting Basics

Shell scripts automate repetitive tasks. Example script:

#!/bin/bash
echo "Hello, $(whoami)! Welcome to Linux."

Save it as hello.sh, then run:

chmod +x hello.sh
./hello.sh

8. System Monitoring

You can monitor processes and performance using:

  • top – real-time process viewer
  • htop – interactive process viewer
  • df -h – check disk usage
  • free -m – check memory usage
  • uptime – system load and uptime

9. Networking Commands

CommandPurpose
pingTest connectivity
ifconfig / ip addrView IP configuration
netstat / ssShow active connections
curlFetch URLs
scpSecurely copy files between systems

10. Why Learn Linux?

  • Runs 90% of cloud infrastructure
  • Foundation for cybersecurity, DevOps, and servers
  • Helps you understand how computers truly work

Final Thoughts

Learning Linux is like unlocking the backstage of modern computing. Once you get comfortable with the command line, you gain control, efficiency, and a deeper understanding of how systems work.

Start small — explore, experiment, and break things (in a virtual machine, of course). That’s the true spirit of Linux.