🔍
👶 Kids📝 Blog About Contact 🚀 Get Started Free

Command Line Basics

Master the terminal with essential commands for navigating files, running programs, and automating tasks.

What is the Command Line?

The command line (also called the terminal, shell, or console) is a text-based interface for interacting with your computer. Instead of clicking icons, you type commands. It's faster, more powerful, and essential for development workflows.

Windows (PowerShell / Command Prompt) vs Unix (Terminal)

Most development tools and tutorials assume a Unix-like environment (Linux/macOS Terminal). On Windows, you can use PowerShell, WSL (Windows Subsystem for Linux), or Git Bash.

Essential Navigation Commands

# Print current directory
pwd

# List files in current directory
ls          # Unix/macOS
dir         # Windows

# List files with details
ls -la      # Hidden files too

# Change directory
cd foldername     # Go into folder
cd ..             # Go up one level
cd ~              # Go to home directory

# Create a directory
mkdir new-folder

# Remove a file
rm filename.txt

# Remove a directory (be careful!)
rm -rf folder-name

# Copy a file
cp source.txt destination.txt

# Move / Rename a file
mv oldname.txt newname.txt

File Reading Commands

# Print file contents
cat filename.txt

# View file one page at a time
less filename.txt

# Show first 10 lines
head filename.txt

# Show last 10 lines
tail filename.txt

Useful Tips

  • Tab completion — Press Tab to auto-complete file/folder names.
  • Up/Down arrows — Navigate through previous commands.
  • Ctrl + C — Cancel a running command.
  • Ctrl + L — Clear the terminal screen.
  • Pipe (|) — Send output of one command to another: ls | grep ".js"
  • Redirect (>) — Save command output to a file: ls > files.txt

Running Programs

# Run a Node.js script
node app.js

# Install npm packages
npm install

# Start a development server
npm run dev

# Run Python script
python script.py

What's Next?

Use these commands with Git & GitHub, or explore Cheat Sheets for quick command references.