AtomLearnAtomLearn
DashboardGoalsPathAchievementsReviewSign In
Linux & Command LineNot Started

Shell Basics

Navigate the file system and manipulate files from the command line

0%
Knowledge0%
Learn & Drill
Fluency0%
Drill & Speed
Retention0%
Mastery & Review
Confidence0%
All modes
Practice
Knowledge
Fluency
Retention

Explanation

The shell is a text interface to your operating system. Every Linux/macOS server and most CI/CD environments run commands you type in a shell — knowing it is non-negotiable for any backend or DevOps work.

Navigation:

bash pwd # print working directory — where am I? ls # list files ls -la # long format + hidden files (names starting with .) cd /etc # change to absolute path cd .. # go up one level cd ~ # go to home directory cd - # go back to previous directory

File and directory operations:

bash mkdir projects # create a directory mkdir -p a/b/c # create nested directories in one command touch file.txt # create empty file (or update timestamp) cp file.txt backup.txt # copy file cp -r src/ dst/ # copy directory recursively mv file.txt /tmp/ # move (also renames: mv old.txt new.txt) rm file.txt # delete file rm -rf old_dir/ # delete directory and contents — no undo!

Reading files:

bash cat file.txt # print whole file less file.txt # page through file (q to quit, / to search) head -n 20 file.txt # first 20 lines tail -n 20 file.txt # last 20 lines tail -f app.log # follow a file as it grows (great for logs)

Finding things:

bash grep "error" app.log # search inside a file grep -r "TODO" src/ # search recursively across files grep -i "error" app.log # case-insensitive find . -name "*.py" # find files by name pattern find /var/log -mtime -1 # files modified in the last 1 day

Pipes and redirection:

bash cat file.txt | grep "error" # pipe output of one command into another ls -la | sort | head -5 # chain multiple commands echo "hello" > out.txt # redirect output to file (overwrites) echo "world" >> out.txt # append to file command 2>&1 | tee output.log # capture stdout+stderr and print+save

Getting help:

bash man ls # full manual page for ls ls --help # quick help (most commands support this) which python # find where a binary lives

Examples

Exploring a project directory

Combining find, grep, and ls -la is the first thing you do when you land on an unfamiliar server.

# Where are we?
pwd
# /home/bill

# Go to a project
cd ~/projects/myapp

# See what is here (including hidden files like .env)
ls -la
# drwxr-xr-x  bill bill 4096 Jun 27 app/
# -rw-r--r--  bill bill  423 Jun 27 .env
# -rw-r--r--  bill bill 1234 Jun 27 requirements.txt

# Search for all Python files
find . -name "*.py" | head -10
# ./app/main.py
# ./app/models.py
# ./tests/test_main.py

# Find any line mentioning "TODO"
grep -rn "TODO" src/
# src/main.py:42: # TODO: add rate limiting

Tailing logs and filtering with pipes

Pipes are the superpower of the shell — each command does one thing, and you compose them to do complex analysis.

# Watch a live log file
tail -f /var/log/app/api.log

# Find errors in the last 100 lines
tail -100 /var/log/app/api.log | grep -i "error"

# Count how many 500 errors occurred
grep "HTTP 500" /var/log/nginx/access.log | wc -l
# 42

# Save filtered output to a file
grep "2026-06-27" /var/log/app/api.log > today.log

# Unique IPs hitting the server
cat /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head -10

How well did you understand this?

Next in Linux & Command Line

File Permissions

Continue