10 Essential Linux Commands
π§ 10 Essential Linux Commands Every Beginner Should Know
π― Overview
Getting started with Linux can feel overwhelming, especially when you're first introduced to the terminal. The good news? You only need to learn a handful of core commands to become productive.
In this guide, weβll cover 10 essential Linux commands that every beginner should know. These commands form the foundation of everyday Linux usage and will help you navigate, manage files, and understand your system.
β‘ Quick Version (TL;DR)
lsβ List filescdβ Move between directoriesmkdirβ Create foldersrmβ Delete files β οΈcpβ Copy filesmvβ Move or rename filespwdβ Show current locationmanβ Get helpchmodβ Change permissionsexitβ Close terminal
π‘ Memory Trick:
π List β Change β Make β Remove β Copy β Move β Print β Manual β Change Mode β Exit
π Main Explanation
1. π ls β List Files and Directories
Displays all files and folders in your current directory.
ls
Useful option:
ls -l
Shows detailed information like permissions, owner, and file size.
2. π cd β Change Directory
Moves you between directories.
cd Documents
Helpful shortcuts:
cd ..β Move up one directorycd ~β Go to your home directorycd /β Go to the root directory
3. π mkdir β Create a Directory
Creates a new folder.
mkdir MyNewFolder
4. β rm β Remove Files and Directories
Deletes files permanently (no recycle bin).
rm file.txt
β οΈ Be careful:
rm -r folder/
Deletes a directory and everything inside it.
5. π cp β Copy Files and Directories
Copies files or folders.
cp file1.txt file2.txt
For directories:
cp -r folder1 folder2
6. π mv β Move or Rename Files
Used to move or rename files.
mv file1.txt file2.txt
mv file.txt /home/user/Documents/
7. π pwd β Print Working Directory
Shows your current directory path.
pwd
8. π man β Manual Pages
Displays help documentation for commands.
man ls
Press q to exit.
9. π chmod β Change File Permissions
Controls access permissions for files.
chmod u+x script.sh
Adds execute permission for the file owner.
10. πͺ exit β Exit the Terminal
Closes your terminal session.
exit
π Command Cheat Sheet
| Command | Purpose | Example |
|---|---|---|
ls |
List files | ls -l |
cd |
Change directory | cd Documents |
mkdir |
Create folder | mkdir Test |
rm |
Delete files | rm file.txt |
cp |
Copy files | cp a.txt b.txt |
mv |
Move/rename | mv a.txt b.txt |
pwd |
Show location | pwd |
man |
Help pages | man cp |
chmod |
Permissions | chmod +x script.sh |
exit |
Close terminal | exit |
π§ Easy Memory Trick
Think of working in Linux like managing a workspace:
- Look around β
ls - Move somewhere β
cd - Create something β
mkdir - Remove clutter β
rm - Copy work β
cp - Move work β
mv - Check location β
pwd - Ask for help β
man - Set rules β
chmod - Leave β
exit
π Real-World Examples
β Scenario 1: Organizing files
mkdir Projects
cd Projects
cp ../notes.txt .
β Scenario 2: Cleaning up files
ls
rm old_file.txt
β Scenario 3: Running a script
chmod +x script.sh
./script.sh
β Final Takeaway
You donβt need to know hundreds of commands to be effective in Linuxβjust these 10 will cover most everyday tasks.
π Start small, practice often, and experiment in a safe directory.
Once youβre comfortable with these, youβll be ready to explore more advanced Linux concepts and commands π