Basic Commands β Your First Steps in the Linux Dojo π₯π§ β
Welcome, young grasshopper! π― You have entered the sacred dojo of Linux Kung Fu. Before you can wield the mighty power of scripts and automation, you must first tame the command line.
Fear not! Your training begins now. Master these basic commands, and soon you shall navigate Linux like a true ninja! π₯·π»
Navigating the Filesystem Like a Ninja β
Think of Linux as a giant dojo, with directories (folders) acting as different training rooms. You must learn how to move silently through them.
Moving Between Folders β
Command | What It Does (in ninja terms) |
---|---|
pwd | πΊ Shows where you are in the dojo (Print Working Directory) |
ls | π Looks around the room (Lists files & folders) |
ls -la | π΅οΈ Unveils hidden scrolls (Shows all files, including hidden ones) |
cd dojo | πͺ Walks into the dojo (Moves into a directory) |
cd .. | πΆββοΈ Walks back to the previous room (Go up one level) |
cd ~ | π Teleports back to your home base (Home directory) |
cd - | π Moves back to where you just were (Switch directories) |
Mastering File & Directory Creation β
A ninja must know how to create and destroy files and folders without leaving a trace!
π Creating & Removing Files β
Command | What It Does |
---|---|
touch scroll.txt | π Creates a new, empty file (like a blank scroll) |
echo "Ninja rule #1: Stay silent." > rules.txt | π£ Writes text into a file |
cat rules.txt | π Reads a file out loud |
rm rules.txt | π Destroys a file (Use with caution, young warrior!) |
π Creating & Removing Directories β
Command | What It Does |
---|---|
mkdir secret_dojo | π― Builds a new training room (Creates a folder) |
rm -r secret_dojo | π Demolishes the dojo (Removes a folder and all inside) |
Training with File Permissions & Ownership β
Not all ninjas can enter all rooms. Permissions determine who can access what!
π‘ Changing File Permissions β
Command | What It Does |
---|---|
ls -l | π Shows who owns what in the dojo |
chmod +x script.sh | π‘ Grants execution powers to a script (Makes it runnable) |
chmod 777 secret.txt | π Dangerous! Gives everyone access (Not recommended!) |
π Changing File Ownership β
Command | What It Does |
---|---|
chown master:warriors scroll.txt | π Gives ownership of a file to a new master |
The Speed Techniques β Aliases & Shortcuts β
A true ninja doesn't type ls -la
every time. We use shortcuts!
π Creating Aliases for Faster Commands β
Command | What It Does |
---|---|
alias ll="ls -la" | π Replaces ll with ls -la (Super speed!) |
alias ninja="echo I am invisible!" | π Creates a fun alias |
To make it permanent, add your aliases to:
bash
~/.bashrc # For Bash users
~/.zshrc # For Zsh users