Getting Started with Linux Terminal
The Linux command line (Terminal) is a powerful tool for controlling your system. Here are fundamental commands every beginner should learn:
🗂️ Navigating & Exploring
-
pwd
(Print Working Directory)
Shows your current folder path.
Example:pwd
→/home/username/Documents
-
ls
(List)
Lists files/folders in your current directory.
Flags:ls -a
→ Shows hidden files (starting with.
)ls -l
→ Detailed list with permissions
-
cd
(Change Directory)
Moves between folders.
Examples:cd Documents
→ Enters “Documents”cd ..
→ Goes back one foldercd ~
→ Returns to home directory
📂 Managing Files & Folders
-
mkdir
(Make Directory)
Creates a new folder.
Example:mkdir Projects
-
touch
Creates an empty file.
Example:touch notes.txt
-
cp
(Copy)
Copies files/folders.
Example:cp file.txt ~/Backup/
-
mv
(Move/Rename)
Moves files or renames them.
Examples:mv old.txt new.txt
(Renames)mv file.txt ~/Documents/
(Moves)
-
rm
(Remove)
Deletes files/folders. ⚠️ Use carefully!
Flags:rm file.txt
→ Deletes a filerm -r folder/
→ Deletes a folder recursively
📝 Viewing & Editing Files
-
cat
(Concatenate)
Shows full file content in the terminal.
Example:cat config.txt
-
less
Views large files page-by-page (pressq
to quit).
Example:less long_log.log
-
nano
Simple text editor.
Example:nano file.txt
→ Edit & save withCtrl+X
→Y
🔍 Finding Content
-
grep
(Global Regular Expression Print)
Searches text patterns in files.
Example:grep "error" log.txt
→ Shows lines containing “error” -
find
Locates files/folders by name.
Example:find . -name "*.jpg"
→ Searches JPEGs in current directory
⚙️ System & Permissions
-
chmod
(Change Mode)
Modifies file permissions.
Example:chmod +x script.sh
→ Makes “script.sh” executable -
sudo
(SuperUser Do)
Runs commands with admin privileges. ⚠️ Requires password -
man
(Manual)
Shows help for any command.
Example:man ls
→ Displays full guide forls
💡 Pro Tips
- Use
Tab
to auto-complete file/folder names. - Press
Ctrl+C
to force-stop any running command. - Chain commands with
&&
(e.g.,mkdir data && cd data
).
Practice these in a safe environment, and you’ll master Linux basics quickly! 🐧