A comprehensive, beginner-friendly guide to essential Linux commands. This repository was created to help students in the Operating Systems course at October 6 University, but it's perfect for anyone starting their Linux journey!
Whether you're a computer science student, a developer transitioning to Linux, or someone curious about the command line, this guide provides:
- Clear explanations of essential Linux commands.
- Practical examples you can try immediately.
- Structured learning from basic to more advanced operations.
- Quick reference for daily use.
- 🚀 Getting Started
- 📋 Prerequisites
- 🎥 Video Tutorials
- 📚 Command Categories
- 💡 Usage Examples
- 🤝 Contributing
- 📄 License
- ⭐ Support
- Open your terminal (Ctrl+Alt+T on most Linux distributions).
- Start with basic commands like
pwd,ls, andcd. - Practice each command in a safe directory.
- Use
man [command]to learn more about any command.
- Any Linux distribution (Ubuntu, Debian, CentOS, etc.)
- Basic understanding of what a terminal is.
- No prior command-line experience required!
💡 Tip: If you're new to Linux, consider starting with a user-friendly distribution like Ubuntu.
I've created comprehensive video playlists (in Arabic) to supplement this guide:
These are the fundamental commands you'll use daily:
| Command | Description | Example |
|---|---|---|
date |
Display the current date and time | date |
cal [month] [year] |
Show calendar for specified month and year | cal 12 2024 |
clear |
Clear the terminal screen | clear |
history |
Show command history | history |
history -c |
Clear all command history | history -c |
whoami |
Display current username | whoami |
who |
Show logged-in users | who |
echo [text] |
Print text to the terminal | echo "Hello World" |
pwd |
Show current directory path | pwd |
cd [directory] |
Change to specified directory | cd /home/user/Documents |
cd - |
Return to previous directory | cd - |
cd .. |
Go up one directory level | cd .. |
ls [directory] |
List files and directories | ls -la |
man [command] |
Display manual page for a command | man ls |
passwd |
Change user password | passwd |
Commands for managing users (requires appropriate permissions):
| Command | Description | Example |
|---|---|---|
su |
Switch to root user | su |
exit |
Logout from current user | exit |
adduser [username] |
Add new user to the system | adduser john |
deluser --remove-home [user] |
Delete user and their home folder | deluser --remove-home john |
Essential commands for creating, viewing, and managing files:
| Command | Description | Example |
|---|---|---|
cat [file] |
Display file contents | cat myfile.txt |
cat > [file] |
Create new file and add content | cat > newfile.txt |
mkdir [directory] |
Create new directory | mkdir my_folder |
rmdir [directory] |
Remove empty directory | rmdir empty_folder |
rm [file] |
Delete file | rm unwanted_file.txt |
rm -r [directory] |
Delete directory and contents | rm -r folder_to_delete |
rm -r -i [directory] |
Delete with confirmation prompts | rm -r -i careful_delete |
Commands for copying, moving, and renaming files and directories:
General Syntax:
cp [options] [source] [destination]
mv [options] [source] [destination]| Command | Description | Example |
|---|---|---|
cp [file1] [file2] |
Copy file1 to file2 | cp document.txt backup.txt |
cp [file1] [file2] [directory] |
Copy multiple files to directory | cp file1.txt file2.txt /backup/ |
cp -r [directory1] [directory2] |
Copy directory and all contents | cp -r project/ project_backup/ |
mv [file1] [file2] |
Move/rename file1 to file2 | mv old_name.txt new_name.txt |
mv [file1] [file2] [directory] |
Move multiple files to directory | mv file1.txt file2.txt /archive/ |
mv [directory1] [directory2] |
Move/rename directory | mv old_folder/ new_folder/ |
mv -i [source] [destination] |
Move with confirmation if destination exists | mv -i important.txt /backup/ |
# Check where you are
pwd
# List files in current directory
ls
# List files with details
ls -la
# List files with human-readable sizes
ls -lh
# Change to home directory
cd ~
# Go to a specific folder
cd Documents
# Go back to previous directory
cd -# Create a new file
touch newfile.txt
# View file content
cat myfile.txt
# Create a directory
mkdir projects
# Copy a file
cp important.txt important_backup.txt
# Move a file to a directory
mv myfile.txt documents/# Get help for any command
man ls
man cp
man mv
# Quick help (if available)
ls --helpWe welcome contributions from the community! Here's how you can help:
- Fork this repository
- Create a new branch (
git checkout -b feature/new-commands) - Add your improvements or new commands
- Commit your changes (
git commit -am 'Add new commands') - Push to the branch (
git push origin feature/new-commands) - Create a Pull Request
- Additional useful Linux commands.
- Better examples and explanations.
- Corrections to existing content.
- Improved formatting and organization.
This project is licensed under the MIT License - see the LICENSE file for details.
⭐ Star this repository if you find it helpful!
🐛 Report issues if you find any problems.
💡 Suggest improvements through issues or pull requests.
Happy learning and welcome to the world of Linux! 🐧