Skip to main content

Command Palette

Search for a command to run...

πŸš€Intro to Linux

Updated
β€’8 min read
πŸš€Intro to Linux

🧠 1. Linux is Open Source and Free

  • You don’t pay license fees like Windows or macOS.

  • The source code is open β€” you can study, modify, and share it.

  • This makes Linux ideal for learning, developing, and experimenting.

πŸ’‘ Example: Ubuntu, Fedora, CentOS, and Debian β€” all free.


βš™οΈ 2. Powerful and Stable Operating System

  • Linux runs servers that stay online for years without reboot.

  • Very few crashes or slowdowns.

  • That’s why most web servers, cloud systems, and supercomputers use Linux.

πŸ’‘ Example: 90%+ of cloud servers on AWS, Azure, GCP run Linux.


πŸ”’ 3. Secure by Design

  • Fewer viruses and malware than Windows.

  • User permissions and file ownership protect the system.

  • Regular security updates from the open-source community.

πŸ’‘ Example: Even if malware runs as a normal user, it can’t modify system files without root access.


🧩 4. Perfect for Developers and DevOps Engineers

  • Comes with all programming tools preinstalled or easily installable:

    gcc, python3, git, vim, bash, etc.

  • Most cloud tools and CI/CD pipelines are designed to run on Linux.

πŸ’‘ Example: Jenkins, Kubernetes, Docker, Terraform β€” all Linux-native tools.


πŸ–₯️ 5. Lightweight and Customizable

  • You can install a full desktop or a minimal command-line system.

  • Every component can be replaced or tuned β€” window manager, shell, even kernel modules.

πŸ’‘ Example: Raspberry Pi, routers, and Android phones all run versions of Linux.


🌐 6. Community and Support

  • Huge global community.

  • Thousands of tutorials, Stack Overflow answers, and open-source contributors.

  • Long-term support versions available (e.g., Ubuntu LTS).


🧭 7. Better for Learning Operating Systems

  • You can explore how everything works β€” processes, memory, kernel, file system.

  • Ideal for students and IT professionals to understand β€œwhat’s under the hood.”

πŸ’‘ Example: Commands like ps, top, df, mount, and /proc show how the system works internally.


⚑ 8. Used Everywhere

SectorLinux Usage Example
ServersWeb servers, mail servers, DNS, databases
CloudAWS EC2, Azure VM, Google Cloud Compute Engine
NetworkingRouters, firewalls, IoT devices
MobileAndroid (based on Linux kernel)
CybersecurityKali Linux, Parrot OS for ethical hacking
DevelopmentContainers, DevOps, AI/ML environments

🧩 Summary

ReasonBenefit
Open SourceFree and transparent
StabilityRarely crashes
SecurityStrong permissions model
PerformanceLightweight and efficient
CommunityHuge global support
VersatilityRuns on servers, phones, clouds
LearningTeaches OS internals clearly

βœ… In short:

Linux = Free + Secure + Stable + Developer-friendly + Everywhere

Os Architecture

LINUX BOOTING PROCESS

  • 🧭 BIOS/UEFI starts – When you power on the computer, the BIOS or UEFI firmware runs first. It checks your hardware (keyboard, RAM, disk, etc.) and finds a bootable device (like hard disk or USB).UEFI is the program built into your motherboard that starts your computer and loads your operating system.

  • πŸ’Ώ Bootloader loads (GRUB) – The BIOS/UEFI loads the bootloader (usually GRUB) from the disk. GRUB shows a menu to choose which OS or kernel to boot.

  • 🧠 Kernel loads – GRUB loads the Linux kernel (the brain of Linux) into memory. The kernel initializes CPU, memory, and hardware drivers.

  • πŸ“¦ Initramfs runs – A temporary filesystem (initramfs) is loaded to help the kernel mount the real root filesystem (like /).

    • What is initramfs?

      initramfs (Initial RAM Filesystem) is a small temporary root filesystem that gets loaded into memory (RAM) by the Linux kernel during boot.

      It contains:

      • Essential drivers (for disk, filesystem, etc.)

      • Tools and scripts to mount the real root filesystem

      • Minimal Linux environment used before the main system starts

  • πŸ“ Root filesystem mounts – The kernel mounts the actual root filesystem (where /bin, /etc, /home, etc. are stored).

  • βš™οΈ Init/Systemd starts – The kernel starts the first process β€” init or systemd β€” which controls the rest of the boot process.

  • πŸ”§ Services start – Systemd starts all required system services (networking, login, GUI, etc.).

  • πŸ’» Login screen appears – Finally, you get the login prompt or desktop screen, ready to use Linux.

    • Key files to remember

      • /boot/grub/grub.conf - GRUB configuration

      • /etc/systemd/system/ - systemd unit files

      • /etc/inittab - Init configuration (traditional)

      • /var/log/boot.log - Boot process logs

Linux File Hierarchy Structure

🧩 Linux vs Windows β€” Filesystem Structure Comparison

Linux DirectoryPurpose in LinuxWindows EquivalentPurpose / Notes in Windows
/Root of the entire Linux file system. Everything starts here.C:\\Root of the primary Windows drive.
/binEssential user binaries (commands needed for all users, like ls, cp, cat).C:\\Windows\\System32Contains core executables (e.g., cmd.exe, system utilities).
/bootBootloader files (kernel, initrd, GRUB).C:\\Boot and C:\\Windows\\BootStores Windows boot manager and related files.
/devDevice files (e.g., /dev/sda for disks, /dev/null).Device Manager (no real folder)Windows uses driver abstraction, not files, for devices.
/etcSystem-wide configuration files (text-based).Windows Registry + C:\\Windows\\System32\\ConfigWindows uses Registry instead of plain text configs.
/homeUser home directories.C:\\UsersEach user has a personal folder (C:\\Users\\Alice).
/libShared libraries essential for binaries in /bin and /sbin.C:\\Windows\\System32Stores system DLLs.
/lib6464-bit system libraries.Same as above (System32 / SysWOW64)Windows uses separate folders for 32-bit and 64-bit libs.
/mediaAuto-mounted removable media (USB, CD-ROM).This PC (drives like E:\\, F:\\)Automatically mounts drives with letters.
/mntTemporary manual mount point for external devices.Temporary drives like E:\\, F:\\Drives are automatically mounted; manual mounting rare.
/optOptional or third-party software (e.g., /opt/google/chrome).C:\\Program FilesInstalled applications.
/procVirtual filesystem showing kernel & process info.Task Manager / WMIC / PowerShellWindows shows process info via APIs, not files.
/rootHome directory for the root (admin) user.C:\\Users\\AdministratorAdmin’s profile directory.
/runTemporary runtime data (PID files, sockets).C:\\Windows\\TempTemporary runtime files.
/sbinSystem binaries (administrative commands, e.g., fsck, ifconfig).C:\\Windows\\System32Contains admin tools like diskpart, netsh.
/srvData served by system services (e.g., web/ftp content).C:\\inetpub (IIS)Web server content or service data.
/sysVirtual filesystem for kernel and hardware interaction.Device Manager (no folder)Managed internally by Windows kernel.
/tmpTemporary files, cleared on reboot.C:\\Windows\\TempWindows temp files.
/usrSecondary hierarchy: user utilities, apps, libraries.C:\\Program Files and C:\\Program Files (x86)Installed programs and shared libraries.
/usr/binNon-essential user commands.C:\\Program FilesUser-installed executables.
/usr/sbinNon-essential system admin commands.C:\\Windows\\System32Admin tools (services, MMC utilities).
/usr/localLocally compiled or manually installed software.C:\\Program Files (manual installs)Apps installed outside official installers.
/varVariable data β€” logs, mail, spool, caches.C:\\ProgramDataStores logs, caches, databases, etc.
/var/logSystem log files.Event Viewer (C:\\Windows\\System32\\winevt\\Logs)Stores event logs.
/var/mailUser mailbox storage.Outlook PST or Mail App DataUser-specific mail storage.
/var/wwwDefault web server root (Apache/Nginx).C:\\inetpub\\wwwrootDefault IIS web root.
/snapSnap package applications (Ubuntu-specific).Microsoft Store appsIsolated, containerized apps.
/lost+foundRecovered files after filesystem errors.CHKDSK recovery folderWindows places recovered files in found.000 folders.

🧠 Summary of Key Differences

ConceptLinuxWindows
StructureEverything under /Each drive (C:, D:) separate
ConfigurationPlain text filesRegistry-based
DevicesRepresented as files under /devManaged by Device Manager
Case sensitivityCase-sensitiveCase-insensitive
MountingManual/automatic under /mnt or /mediaDrive letters assigned automatically
PermissionsOwner, group, others (chmod, chown)NTFS ACLs
Logging/var/logEvent Viewer

Login to Linux server:

ssh -i demo.pem ubuntu@<public-ip>
sudo apt update ## on ubuntu
sudo yum update ## on redhat, ceentos, amazon linnx
ping <IP>
curl ifconfig.me # Prints public ip
hostname -i # Prints private ip

Working with Files and directories

# Task-1
cd
pwd
cd ~
pwd
cd /
pwd
mkdir dir1
pwd

# Task-2
mkdir -p dir1/dir2/dir3
touch dir1/dir2/dir3/file{1..3}
tree dir1
mv dir1/dir2/dir3/file1  dir1
mv dir1/dir2/dir3/file2  dir1/dir2
tree dir1
mkdir dd
rmdir dd
rmdir dir1
rm -r dir1/dir2/dir3
tree dir1
rm -rf dir1/dir2
tree dir1
rm -rf dir1
tree dir1

# Task-3
mkdir test
cd test
touch file{1..3}.txt
tree
mkdir -p dir1/backup
tree
mv file1.txt file2.txt file3.txt dir1/backup/
tree

# Task-4
Create a world,countries,states hieghrarchy folder structure:

#!/bin/bash
# world_structure.sh
mkdir -p world/{India/{Andhra_Pradesh,Karnataka,Tamil_Nadu,Maharashtra},\\
USA/{California,Texas,New_York,Florida},\\
Australia/{New_South_Wales,Victoria,Queensland}}

echo "Capital: Amaravati" > world/India/Andhra_Pradesh/info.txt
echo "Capital: Austin" > world/USA/Texas/info.txt
echo "Capital: Melbourne" > world/Australia/Victoria/info.txt

ls -R world

# Task-5
touch hotstar
mv hotstar jiohotstar

# Task-5
touch {a..n}.txt
touch report_{1..10}

## Using Wildcards
mv *.txt /home/ubuntu/Documents/ ## Moves all text files in the current folder.

mv report_* /home/ubuntu/reports/  ## Moves all files that start with report_.

# Task-6
touch file1.txt file2.txt
vi file1.txt file2.txt
mv /home/ubuntu/file.txt /home/ubuntu/newfile.txt

Moves the file and renames it in one go.

# Task-7
touch file1.txt file2.txt
# Horizontal Split (one above another)
vim -o file1.txt file2.txt
# Vertical Split (side by side)
vim -O file1.txt file2.txt

Move Between Windows

Press:

Ctrl + w + w     # βœ… This toggles between open windows.

Or use:

Ctrl + w + β†’ β†’ move right

Ctrl + w + ← β†’ move left

:wqall  # βœ… Saves and exits all open files

More from this blog

thiru's blog

43 posts