File System Navigation

The terminal is your most powerful tool. Learn to navigate it fluently.

Essential commands

bash
# Where am I?
pwd
# /home/user/projects

# List files
ls          # basic
ls -la      # detailed (permissions, size, dates)
ls -lah     # human-readable sizes

# Change directory
cd projects     # relative path
cd /home/user   # absolute path
cd ..           # go up one level
cd ~            # go home
cd -            # go back to previous directory

File operations

bash
# Create
mkdir my-project          # create directory
mkdir -p src/components   # create nested directories
touch index.html          # create empty file

# Copy
cp file.txt backup.txt           # copy file
cp -r src/ src-backup/           # copy directory

# Move / Rename
mv old-name.txt new-name.txt     # rename
mv file.txt ../                  # move up one level

# Delete
rm file.txt              # delete file
rm -r directory/         # delete directory
rm -rf node_modules/     # force delete (careful!)

Viewing files

bash
cat file.txt         # show entire file
less file.txt        # scroll through file (q to quit)
head -20 file.txt    # first 20 lines
tail -20 file.txt    # last 20 lines
tail -f logs.txt     # follow file in real-time (great for logs)

Finding things

bash
# Find files by name
find . -name "*.tsx"

# Search file contents
grep -r "TODO" src/
grep -rn "function" --include="*.ts" src/