Linux Basic Commands 1-20 Commands Class 1
basic_linux_commands.md.
# 🐧 Basic Linux Commands — Explained Simply
This guide covers 20 essential Linux terminal commands that every beginner should know.
They help you **navigate**, **view**, **create**, and **edit** files and folders in your system.
---
## 🧭 1. `pwd` — Print Working Directory
**Meaning:** Shows the directory (folder) you’re currently in.
**Example:**
```bash
pwdOutput:
/home/student/Documents
Meaning: Displays files and folders inside the current directory.
Examples:
ls
ls -l
ls -a-l→ detailed info (permissions, size, date)-a→ includes hidden files (those starting with.)
Meaning: Moves you to another folder.
Examples:
cd Documents
cd ..
cd ~
cd /..→ up one level~→ home directory/→ root directory
Meaning: Creates a new folder.
Examples:
mkdir projects
mkdir -p myfolder/subfolder1/subfolder2The -p flag creates nested folders.
Meaning: Deletes an empty directory.
Example:
rmdir old_folderIf the folder isn’t empty, use rm -r.
Meaning: Deletes files or folders permanently (no trash bin).
Examples:
rm file.txt
rm -r folder_name
rm -rf folder_name-rf forces deletion — use with caution!
Meaning: Duplicates files or directories.
Examples:
cp notes.txt backup_notes.txt
cp -r folder1 folder2The -r flag means “recursive,” for copying folders.
Meaning: Moves or renames files/folders.
Examples:
mv file.txt /home/student/Documents/
mv oldname.txt newname.txtMeaning: Displays the whole content of a file.
Examples:
cat notes.txt
cat file1.txt file2.txt > combined.txtMeaning: Shows file contents from bottom to top.
Example:
tac notes.txtMeaning: Opens large files for easy scrolling.
Example:
less bigfile.txtUse:
↑/↓or Space → scrollq→ quit
Meaning: Similar to less, but older and more basic.
Example:
more longtext.txtPress Space for next page, q to quit.
Meaning: Displays the first 10 lines by default.
Examples:
head notes.txt
head -n 5 notes.txtMeaning: Displays the last 10 lines by default.
Examples:
tail notes.txt
tail -n 20 notes.txt
tail -f log.txt-f follows updates in real-time — useful for monitoring logs.
Meaning: Prints text or variable values on screen.
Examples:
echo Hello World
echo $HOME
echo "My name is $USER"Meaning: Creates a new empty file or updates a file’s “last modified” time.
Examples:
touch newfile.txt
touch file1.txt file2.txtMeaning: Opens a beginner-friendly editor in the terminal.
Example:
nano notes.txtShortcuts:
Ctrl + O→ saveCtrl + X→ exitCtrl + K→ cut lineCtrl + U→ paste line
Meaning: A powerful but older text editor.
Example:
vi file.txtModes:
i→ insert textEsc→ exit insert mode:wq→ save & quit:q!→ quit without saving
Meaning: An enhanced version of vi with colors and more features.
Example:
vim script.shCommon Commands:
i→ insertEsc→ command mode:w→ save:q→ quit:wq→ save & quitu→ undo/word→ search text
Meaning: Clears everything currently visible in the terminal.
Examples:
clearor use the shortcut:
Ctrl + L
This simply gives you a clean screen but doesn’t delete any data or history.
| # | Command | Description | Example |
|---|---|---|---|
| 1 | pwd |
Show current directory | pwd |
| 2 | ls |
List files | ls -l |
| 3 | cd |
Change directory | cd Documents |
| 4 | mkdir |
Create folder | mkdir new_folder |
| 5 | rmdir |
Delete empty folder | rmdir old |
| 6 | rm |
Delete files/folders | rm -r myfolder |
| 7 | cp |
Copy files | cp file1.txt backup.txt |
| 8 | mv |
Move or rename | mv file.txt folder/ |
| 9 | cat |
Show file | cat file.txt |
| 10 | tac |
Show file reversed | tac file.txt |
| 11 | less |
Scroll through file | less file.txt |
| 12 | more |
View file page by page | more file.txt |
| 13 | head |
Show start of file | head file.txt |
| 14 | tail |
Show end of file | tail -n 20 file.txt |
| 15 | echo |
Print text | echo Hello |
| 16 | touch |
Create empty file | touch new.txt |
| 17 | nano |
Simple editor | nano notes.txt |
| 18 | vi |
Classic editor | vi notes.txt |
| 19 | vim |
Enhanced editor | vim notes.txt |
| 20 | clear |
Clear terminal screen | clear |
Created for Fedora/Linux beginners learning to navigate the terminal. Ideal for classroom teaching or self-learning.
Maintained by: [EFXTv] License: MIT Last Updated: November 2025