Skip to content

Files & Directories – The Warrior’s Arsenal

Ah, young warrior! 🥷

Before you wield the sword of scripting or summon the spirits of automation, you must first master the battlefield – the file system!

A true Linux warrior knows:

How to create, move, and delete files

How to navigate like a shadow in the night

How to organize folders like a disciplined samurai

Let’s begin your training! 🎯

Moving Like a Ninja – Navigating Directories

The first skill every warrior must master is navigation. If you don’t know where you are, you are already lost. 😱

CommandWhat It Does
pwd📍 Shows your current location
ls📜 Lists files in a directory
ls -la👀 Shows hidden files (stealth mode)
cd folder_name🚶 Moves inside a directory
cd ..🔙 Moves one level up
cd -⏪ Returns to previous directory

💡 Try it now:

bash
pwd  # See where you are
ls   # Check what’s inside
cd .. # Move up

You are now one step closer to mastery! 🎯

Creating & Destroying – The Art of File Management

A warrior must know how to create and destroy files & directories with precision!

Creating Files & Folders

CommandWhat It Does
touch myfile.txt📄 Creates an empty file
mkdir myfolder📁 Creates a new directory
mkdir -p parent/child🏯 Creates nested directories

💡 Example:

bash
touch ninja.txt   # Creates a file
mkdir dojo        # Creates a directory
mkdir -p dojo/hidden/secrets  # Creates nested directories

Deleting Files & Folders (Proceed with caution!)

CommandWhat It Does
rm myfile.txt💀 Deletes a file forever
rm -r myfolder🔥 Deletes a folder and its contents
rm -rf /☠️ DO NOT RUN! This will wipe out your entire system!

💡 Pro Tip: Always double-check before using rm -r, or risk accidentally deleting everything! 😱

Moving & Renaming – The Art of Stealth

A ninja must know how to move without a trace.

CommandWhat It Does
mv file.txt folder/🚚 Moves a file into a folder
mv old.txt new.txt✍️ Renames a file
mv file1 file2 folder/📦 Moves multiple files

💡 Example:

bash
mv secret.txt dojo/  # Moves secret.txt into the dojo
mv oldname.txt newname.txt  # Renames a file

Finding Files – The Ninja’s Sixth Sense

Lost something? A true Linux warrior finds files instantly.

CommandWhat It Does
find /home -name "ninja.txt"🔍 Searches for a file by name
locate ninja.txt🚀 Faster way to find a file
du -sh folder/📏 Shows size of a folder

💡 Example:

bash
find / -name "passwords.txt"  # Locate a file (if it exists 😏)
du -sh /var/www/  # Check folder size

Built by noobs, for noobs, with love 💻❤️