🦥 The Command Line For Dummies

Read on our website

Hello weirdos,

Welcome to this week’s Sloth Bytes. I hope you had a great week.

Every AI Agent Has Its Strengths. Why Use Just One?

BLACKBOX AI runs all coding agents in parallel including Blackbox Agent, Claude Code, Codex, and Gemini to tackle your problem simultaneously.

An LLM judge then evaluates each solution, ranks them, and automatically selects the best, most reliable code. That implementation becomes your PR.

The results speak for themselves:

  • Trusted by 30M+ developers

  • 35+ IDE integrations

  • End-to-end encrypted

One platform. All the agents. The best answer wins.

Command-Line Interface (CLI)

Everyone has used a command-line interface at least ONCE in their lives.

If you've ever run npm install, pushed code with Git, or watched any type of coding tutorial, congrats, you've touched the command line.

What Exactly Is a Command Line Interface

The command line aka shell, aka terminal, aka bash, aka powershell, aka…

A CLI is a text-based interface that lets you talk directly to your operating system.

Imagine it like texting your computer commands instead of clicking buttons.

Instead of: right-click → New → Folder → type name

You type:

mkdir new_folder_yayyy

Done. One line. One second.

It's fast. It's efficient. It looks intimidating at first, but it's mostly just verbs.

You're literally just telling your computer to do stuff

Sloth Does This Even Matter in 2025? We Have GUIs 🤓 👆️ 

Well… You must be a web developer, but also a fair question!

It's true we have beautiful GUIs for everything now: GitHub Desktop, Docker Desktop, etc.

But they're all abstractions.

  • When you click "Push" in GitHub Desktop, it's running git push.

  • When you start a container in Docker Desktop, it's running docker run.

The GUI is just plastic surgery for the CLI.

Every Developer Tool Runs on CLI

As a developer, it’s very important to understand the CLI because every single modern tool you use is fundamentally CLI-driven.

CI/CD pipelines, Cloud platforms, Infrastructure as code, etc.

When CLI Beats GUI

1. Automation

Come on, you’re a programmer. You should know this.

If you have something you do 50 times a day, write a script for it.

A lot of GUIs don’t have this feature which means you have to use your little human brain and keep doing the same mouse clicks.

Ex: Want to resize 10,000 images?

With a GUI, you're clicking for days.

But with a CLI:

for img in *.jpg; do convert $img -resize 800x600 thumb_$img; done

Two minutes. Done.

Even if the GUI has this feature, guess how they did it 😉 

2. Reproducibility

CLI commands work identically every time.

Documentation becomes actual commands you can copy-paste:

# Setup dev environment
git clone repo
cd repo
npm install
#cp command = copy paste files and directories
cp .env.example .env
npm run dev

Anyone can run that. Anywhere. Every time. Same result.

AI coding tools absolutely love the CLI for this reason.

You can't tell an AI to "click the third button on the left." It can’t see like a human.

But you can tell it to run docker compose up -d and it works perfectly every time.

The future of development is increasingly AI-assisted (whether you like it or not)

And AI speaks CLI fluently.

Types of CLIs

System Shells:

  • Bash - Default on Linux/older Macs. Maximum compatibility.

  • Zsh - Default on newer Macs. Better autocomplete. I recommend Oh My Zsh.

  • Fish - Modern, great features, different syntax (won't work everywhere).

  • PowerShell - Microsoft's shell. Cross-platform now.

Third-party terminals (highly recommend using one of them):

  • iTerm2 (macOS) - Split panes, search history, deep customization. The gold standard for Mac users.

  • Alacritty (Cross-platform) - GPU-accelerated, blazing fast, minimal features. For speed freaks.

  • Warp (Cross-platform) - Modern terminal with AI features, IDE-like autocomplete, and command blocks.

  • Ghostty (macOS/Linux) - New, stupid fast, native performance. Built by the Zig creator.

For 90% of dev work, the type of CLI doesn’t matter.

The commands might be a little different but they’ll do the same thing.

The Only Commands You Actually Need to Know

Hot take: you don't need to memorize hundreds of commands. You need like 10.

Here’s 10 commands I use the most:

  1. pwd - Print working directory. Shows your current location in the file system.

  2. ls - List files and folders in the current directory.

  3. cd - Change directory. Navigate between folders.

  4. mkdir - Make directory. Create new folders.

  5. touch - Create empty files or update file timestamps.

  6. rm - Remove files or folders. (Be careful—no undo!)

  7. grep - Search for text patterns across files.

  8. find - Search for files and folders by name, type, or other criteria.

  9. curl - Make HTTP requests to test APIs and download files.

  10. ssh - Securely connect to remote servers.

Obviously there’s more, but this is a good foundation.

CLI Life Hacks You Should Know About

1. Grep - Search Text Across Files

grep searches for text patterns across your entire codebase. It's like Ctrl+F but for your whole project.

Use cases:

  • Find where functions are called

  • Locate API endpoints across files

  • Hunt down TODO comments

  • Search error logs

  • Find imports or dependencies

Examples:

# Search for a function with line numbers
grep -rn "myFunction" src/

# Find API endpoints, exclude build folders
grep -r "/api/users" . --exclude-dir={node_modules,dist}

# Chain greps: find useState, exclude tests, only show User
grep -r "useState" src/ | grep -v "test" | grep "User"

2. For Loops - Automate Repetitive Tasks

For loops execute the same command on multiple items. Perfect for batch operations that would take forever clicking through a GUI.

Use cases:

  • Rename multiple files at once

  • Process images/videos in bulk

  • Run tests across multiple packages

  • Check status of multiple services

  • Create multiple config files

Examples:

# Rename .jsx to .tsx (React → TypeScript migration)
for file in src/**/*.jsx; do
  mv "$file" "${file%.jsx}.tsx"
done

# Check which microservices are running
for port in 3000 3001 3002 3003; do
  curl -s http://localhost:$port/health && echo "$port: UP" || echo "$port: DOWN"
done

# Process all images in parallel
for image in images/*.jpg; do
  convert "$image" -resize 800x600 "thumbnails/$(basename $image)" &
done
wait

3. Curl - Make HTTP Requests

curl makes HTTP requests from your terminal.

Use cases:

  • Test your local API during development

  • Check if endpoints are working

  • Debug authentication flows

  • Test file uploads

  • Measure API response times

Examples:

# GET request with pretty-printed JSON
curl http://localhost:3000/api/users | jq

# POST request with auth
curl -X POST http://localhost:3000/api/login \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "password": "test123"}'

# Save auth token and reuse it
TOKEN=$(curl -s -X POST http://localhost:3000/api/login \
  -d '{"email": "[email protected]", "password": "test123"}' | jq -r '.token')

curl -H "Authorization: Bearer $TOKEN" http://localhost:3000/api/protected

4. Aliases - Create Command Shortcuts

Aliases are custom shortcuts for commands you use frequently. Type less, do more.

Use cases:

  • Shorten long git commands

  • Create quick navigation shortcuts

  • Simplify Docker commands

  • Make common dev tasks one word

Examples:

# Add these to ~/.bashrc or ~/.zshrc

# Git shortcuts
alias gs='git status'
alias ga='git add .'
alias gp='git push'

# Docker shortcuts
alias dc='docker compose'
alias dcu='docker compose up -d'

# Navigation shortcuts
alias ..='cd ..'
alias projects='cd ~/Projects'

5. Pipes - Chain Commands Together

Pipes (|) take the output of one command and feed it as input to another. This is how you combine simple tools to solve complex problems.

Use cases:

  • Filter and process data in stages

  • Search through command outputs

  • Format and transform data

  • Count, sort, and analyze results

  • Build powerful one-liners

Examples:

# Find the 10 largest files in your project
du -ah . | sort -rh | head -10

# Count how many times each error appears in logs
grep "ERROR" app.log | sort | uniq -c | sort -rn

# Find JavaScript files, exclude node_modules, count them
find . -name "*.js" | grep -v node_modules | wc -l

# Get all git contributors sorted by commit count
git log --format='%an' | sort | uniq -c | sort -rn

# Monitor logs in real-time and filter for errors
tail -f app.log | grep -i "error"

Modern Tools That Make the CLI less painful

Here's something that doesn't get talked about enough: the terminal has gotten dramatically better in the past few years.

Developers rewrote crusty Unix utilities in Rust with modern UX in mind. The result? Tools that are faster, smarter, and way more pleasant to use.

ripgrep (rg) - grep on steroids. It's 5-10x faster, respects .gitignore automatically, and VSCode uses it internally. That's how good it is.

bat - cat with syntax highlighting, git integration, and line numbers. Once you try it, regular cat feels like a flip phone.

exa (now eza) - makes ls readable with colors, icons, and git status inline.

zoxide - Learns which directories you visit most. Instead of cd ~/Projects/work/client-project/src/components/, I type z comp. Saves 60% of my navigation keystrokes.

If you’re a nerd, check these out:

Thanks to everyone who submitted!

When Should You Go to Sleep?

You’re setting an alarm for the next morning and know how long you want to sleep.
Your job is to figure out what time you need to go to bed to get that amount of sleep.

Each input has two parts:

  1. The alarm time (when you’ll wake up).

  2. The sleep duration (how long you want to sleep).

Return the time you should go to bed — in 24-hour format ("HH:MM").

bedTime(["07:50", "07:50"])
output = ["00:00"]

bedTime(["06:15", "10:00"], ["08:00", "10:00"], ["09:30", "10:00"])
output = ["20:15", "22:00", "23:30"]


bedTime(["05:45", "04:00"], ["07:10", "04:30"])
output = ["01:45", "02:40"]

How To Submit Answers

Reply with

  • A link to your solution (github, twitter, personal blog, portfolio, replit, etc)

  • or if you’re on the web version leave a comment!

  • If you want to be mentioned here, I’d prefer if you sent a GitHub link or Replit!

That’s all from me!

Have a great week, be safe, make good choices, and have fun coding.

If I made a mistake or you have any questions, feel free to comment below or reply to the email!

See you all next week.

What'd you think of today's email?

Login or Subscribe to participate in polls.

Want to advertise in Sloth Bytes?

If your company is interested in reaching an audience of developers and programming enthusiasts, you may want to advertise with us here.

Reply

or to participate.