Terminal Basics — Command Line for Developers

Learn essential terminal commands: file navigation, permissions, pipes, search, and productivity shortcuts every developer needs.

General Beginner 📖 8 min

Navigation

pwd                     # Print working directory
ls                      # List files
ls -la                  # List all files with details
cd ~/projects           # Change directory
cd -                    # Go to previous directory
~                       # Home directory shortcut

File Operations

mkdir -p src/components  # Create directory recursively
touch file.txt           # Create empty file
cp file.txt backup.txt   # Copy file
mv old.txt new.txt       # Move/rename file
rm file.txt              # Delete file
rm -rf directory/        # Delete directory recursively

Viewing Files

cat file.txt             # Print entire file
head -n 20 file.txt      # First 20 lines
tail -n 20 file.txt      # Last 20 lines
tail -f log.txt          # Follow file in real-time
less file.txt            # Paginated view (q to quit)

Searching

grep -r "TODO" src/       # Search recursively in directory
grep -i "error" log.txt   # Case-insensitive search
find . -name "*.js"       # Find files by name
which node                # Find command location

Pipes and Redirection

ls -la | grep ".txt"      # Pipe output to grep
echo "hello" > file.txt   # Redirect output to file
echo "world" >> file.txt  # Append to file
cat file1.txt file2.txt > combined.txt

Productivity Shortcuts

history                   # Command history
Ctrl+R                    # Reverse search history
Ctrl+C                    # Cancel current command
Ctrl+L                    # Clear screen
!!                        # Repeat last command
!$                        # Last argument of previous command

Ready to Level Up Your Coding Skills?

Join Coderz Club and learn to code with challenges, battles, and an AI mentor.

Join Coderz Club Free →