Linux is a powerful open-source operating system widely used in servers, cloud infrastructure, DevOps environments, cloud computing platforms, and embedded systems.
Most interactions with Linux systems are performed through the Command Line Interface (CLI) using a terminal. The CLI provides powerful utilities to manage files, processes, networks, packages, and system resources.
This document provides a structured overview of essential Linux concepts and commonly used commands for developers, system administrators, and DevOps engineers.
- Linux Architecture
- Linux Architecture Diagram
- Linux File System Hierarchy
- File and Directory Management
- File Viewing and Editing
- File Permissions and Ownership
- File Searching and Text Processing
- System Information
- Process Management
- Package Management
- Networking Commands
- Disk and Storage Management
- Compression and Archiving
- Shell and I/O Redirection
- User and Group Management
- Service Management (systemd)
- Command Execution Diagrams
- Repository Preview
- Contributing
- Miscellaneous Commands
Linux follows a layered architecture that separates hardware from user applications.
Applications
↓
Shell
↓
Kernel
↓
Hardware
Kernel
The kernel is the core of the Linux operating system. It manages:
- CPU scheduling
- Memory management
- Device drivers
- File systems
- Process management
Shell
The shell is a command interpreter that allows users to interact with the kernel using commands.
Common shells:
- Bash
- Zsh
- Fish
Example:
echo "Hello Linux"
This diagram shows how user applications communicate with hardware through the shell and kernel layers.
Linux organizes files using a standardized directory structure known as the Filesystem Hierarchy Standard (FHS).
Important directories:
| Directory | Description |
|---|---|
/ |
Root directory |
/bin |
Essential user binaries |
/etc |
System configuration files |
/home |
User home directories |
/var |
Log files and variable data |
/tmp |
Temporary files |
/usr |
User applications and utilities |
/root |
Root user home directory |
Example:
cd /home
ls
Linux stores data in a hierarchical structure starting from the root directory /.
Common operations include:
- Navigating directories
- Creating files and folders
- Copying and moving files
- Deleting files
| Command | Description |
|---|---|
pwd |
Display current directory |
ls |
List directory contents |
ls -l |
Detailed list |
ls -a |
Show hidden files |
cd <dir> |
Change directory |
cd .. |
Move to parent directory |
mkdir <dir> |
Create directory |
mkdir -p <dir> |
Create nested directories |
rmdir <dir> |
Remove empty directory |
rm <file> |
Remove file |
rm -r <dir> |
Remove directory recursively |
rm -rf <dir> |
Force delete directory |
cp <src> <dest> |
Copy file |
cp -r <dir> |
Copy directory |
mv <src> <dest> |
Move or rename file |
touch <file> |
Create file |
stat <file> |
Show file metadata |
Example:
mkdir project
cd project
touch app.py
ls -l
Linux provides utilities to inspect and modify files directly from the terminal. These tools are commonly used to analyze logs and edit configuration files.
| Command | Description |
|---|---|
cat <file> |
Display file |
less <file> |
Scroll through file |
more <file> |
Basic file viewer |
head <file> |
First 10 lines |
tail <file> |
Last 10 lines |
tail -f <file> |
Monitor logs |
nano <file> |
Simple editor |
vim <file> |
Advanced editor |
Example:
tail -f system.log
Linux uses a permission system to control access to files.
Permission types:
- Read (r)
- Write (w)
- Execute (x)
Permission categories:
- Owner
- Group
- Others
Example:
-rwxr-xr--
| Command | Description |
|---|---|
chmod |
Change permissions |
chmod +x |
Make executable |
chown |
Change file owner |
chgrp |
Change group |
ls -l |
View permissions |
umask |
Default permission mask |
Example
chmod 755 script.sh
Linux provides powerful utilities for searching files and processing text.
These commands are widely used for log analysis, scripting, and automation.
| Command | Description |
|---|---|
find |
Search files |
grep |
Search text |
locate |
Fast file search |
which |
Locate executable |
whereis |
Locate binaries |
awk |
Pattern processing |
sed |
Stream editing |
Example
grep "error" server.log
| Command | Description |
|---|---|
uname -a |
System info |
hostname |
Host name |
uptime |
System uptime |
whoami |
Current user |
who |
Logged users |
id |
User ID |
lscpu |
CPU info |
free -h |
Memory usage |
df -h |
Disk usage |
du -sh |
Directory size |
A process is a running instance of a program.
Linux provides commands to monitor and control processes.
| Command | Description |
|---|---|
ps |
Show processes |
ps aux |
Detailed process list |
top |
Real-time monitoring |
htop |
Interactive monitor |
kill |
Stop process |
kill -9 |
Force stop |
pkill |
Kill by name |
jobs |
Show background jobs |
bg |
Resume background job |
fg |
Bring job to foreground |
Package managers install, update, and remove software.
Debian-based systems use APT.
| Command | Description |
|---|---|
apt update |
Update packages |
apt upgrade |
Upgrade system |
apt install |
Install software |
apt remove |
Remove software |
apt purge |
Remove config files |
apt autoremove |
Remove dependencies |
apt search |
Search packages |
| Command | Description |
|---|---|
ping |
Test connectivity |
ip a |
Show interfaces |
ip route |
Routing table |
netstat -tuln |
Show ports |
ss -tuln |
Modern netstat |
curl |
Fetch web content |
wget |
Download files |
ssh |
Remote login |
scp |
Secure copy |
| Command | Description |
|---|---|
lsblk |
List disks |
df -h |
Disk usage |
du -sh |
Directory size |
mount |
Mount filesystem |
umount |
Unmount filesystem |
fdisk -l |
Disk partitions |
| Command | Description |
|---|---|
tar -cvf |
Create tar archive |
tar -xvf |
Extract tar |
tar -czvf |
Create gzip archive |
tar -xzvf |
Extract gzip |
zip |
Create zip |
unzip |
Extract zip |
gzip |
Compress file |
gunzip |
Decompress file |
Linux allows redirecting command output.
| Symbol | Description | |
|---|---|---|
> |
Redirect output | |
>> |
Append output | |
| ` | ` | Pipe output |
< |
Redirect input |
Example:
ls > files.txt
cat log.txt | grep error
| Command | Description |
|---|---|
adduser |
Create user |
userdel |
Delete user |
usermod |
Modify user |
groupadd |
Create group |
groupdel |
Delete group |
passwd |
Change password |
Modern Linux systems use systemd.
| Command | Description |
|---|---|
systemctl start |
Start service |
systemctl stop |
Stop service |
systemctl restart |
Restart service |
systemctl status |
Check status |
systemctl enable |
Start on boot |
systemctl disable |
Disable on boot |
Example
systemctl restart nginx
Linux Command Execution Flow
Command flow:
User Command
↓
Shell
↓
Kernel
↓
Hardware
Contributions are welcome to improve this repository.
Steps to contribute:
-
Fork the repository
-
Create a new branch
git checkout -b feature-update
- Commit changes
git commit -m "Added new Linux command examples"
- Push to your fork
git push origin feature-update
- Open a Pull Request
Please ensure:
- Commands are accurate
- Formatting remains consistent
- Examples are tested
| Command | Description |
|---|---|
date |
Show date |
cal |
Show calendar |
history |
Command history |
clear |
Clear terminal |
echo |
Print text |
alias |
Command shortcut |
man |
Manual pages |
Example
man ls
Add a Star⭐ if you find this Repository Helpful !!



