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:
- Hardware – The physical components (CPU, memory, storage, etc.)
- Kernel – The core that interacts with hardware and manages system resources
- Shell – The command-line interface that interprets user commands
- 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:
| Directory | Purpose |
|---|---|
/home | Contains user files and directories |
/etc | Configuration files |
/bin | Essential user commands |
/usr | User-installed software |
/var | Variable data like logs |
/tmp | Temporary files |
You can explore them using the command:
ls /4. Essential Linux Commands
Here are some of the most frequently used commands:
| Command | Description |
|---|---|
pwd | Show current working directory |
ls | List files and directories |
cd | Change directory |
cp | Copy files |
mv | Move or rename files |
rm | Remove files |
cat | View file content |
grep | Search inside files |
chmod | Change file permissions |
sudo | Run command as superuser |
Example:
sudo apt update && sudo apt upgradeThis 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.shThis gives full permission to the owner, and read/execute to others.
6. Package Management
Different Linux distributions use different package managers:
| Distro | Package Manager | Example Command |
|---|---|---|
| Ubuntu/Debian | APT | sudo apt install nginx |
| Fedora | DNF | sudo dnf install nginx |
| Arch | Pacman | sudo 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.sh8. System Monitoring
You can monitor processes and performance using:
top– real-time process viewerhtop– interactive process viewerdf -h– check disk usagefree -m– check memory usageuptime– system load and uptime
9. Networking Commands
| Command | Purpose |
|---|---|
ping | Test connectivity |
ifconfig / ip addr | View IP configuration |
netstat / ss | Show active connections |
curl | Fetch URLs |
scp | Securely 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.