What is Linux?
The operating system Linux is open-source and free. Though it is more popular among servers, developers, and computer aficionados, it is comparable to Windows or macOS. It was developed in 1991 by Linus Torvalds and is based on Unix.
Why Study Linux?
extensively utilized in development, cloud computing, servers, and cybersecurity. Linux powers the majority of supercomputers, Android systems, and web servers. Excellent for system administration and command-line learning.
Common Linux Distributions (Distros): Ubuntu is easy to use and suitable for novices. Fedora: advanced features. Debian is incredibly stable. Rocky Linux and CentOS are server-oriented. Kali Linux: for cybersecurity and ethical hacking.
Fundamental Linux Components Kernel: The OS’s central component. Shell: Command-interaction interface with the operating system.
File System: A hierarchical arrangement of folders and files. Terminal: A command-line interface for system management.
Basic Linux Commands
| Command | Description |
|---|---|
pwd | Show current directory/present working directory |
ls | List files and folders |
cd | Change directory |
mkdir | Create a new directory/make a directory |
| rmdir | Remove an empty directory |
touch | Create a new empty file |
rm | Remove files or directories |
cp | Copy files or folders |
mv | Move or rename files |
cat | Show file content |
nano, vim | Text editors |
clear | Clear the terminal screen |
man | Show manual for commands (e.g., man ls) |
| rm-rf | Remove a content file/folder |
Linux File System Structure
bashCopyEdit/ - Root directory
/home - User home directories
/bin - Essential binaries
/etc - Configuration files
/var - Logs and variable files
/usr - User-installed software
/tmp - Temporary files
File Permissions in Linux
file permissions control who can read, write, or execute a file or directory. Each file has three types of permissions for three categories of users.
Categories of Users
Owner (u) – The user who owns the file.
Group (g) – The group assigned to the file.
Others (o) – Everyone else.
Linux controls who can read, write, and execute files:
r = read
w = write
x = execute
Permission Format (ls -l)
Example:
bash
Copy
Edit
-rwxr-xr-- 1 user group 1234 Jul 7 myfile.sh
- = Regular file (can be d for directory)
rwx = Owner has read, write, execute
r-x = Group has read, execute
r-- = Others have only read
Numeric (Octal) Notation
Each permission has a value:
Read (r) = 4
Write (w) = 2
Execute (x) = 1
Add them to get the total for each category:
Octal Permissions Meaning
7 rwx Full permissions
6 rw- Read & write
5 r-x Read & execute
4 r-- Read only
0 --- No permissions
Use ls -l to check permissions:
Change permissions using:
chmod: Change permissionchown: Change ownership
Package Management
Install and manage software:
| Distro | Tool | Example |
|---|---|---|
| Ubuntu/Debian | apt | sudo apt install nginx |
| Fedora/RedHat | dnf | sudo dnf install nginx |
| Arch | pacman | sudo pacman -S nginx |