All Articles
Tech News8 min read

Mastering the Linux Terminal: Commands That Save Hours

Move beyond cd and ls. Master grep, awk, sed, pipes, and scripting to automate your dev workflow.

T

TechGyanic

November 22, 2025

Mastering the Linux Terminal: Commands That Save Hours

I used to use the GUI for everything. Searching text? VS Code. Renaming files? Finder. Then I watched a senior dev fix a production log issue in 10 seconds using grep and I was hooked.

The Power of Pipes |

Pipes let you pass the output of one command as input to another. This is the Unix philosophy: "Do one thing well."

# Find all error logs, count unique errors, sort by frequency
cat app.log | grep "ERROR" | cut -d: -f2 | sort | uniq -c | sort -nr

Grep: Search Like a Pro

grep stands for Global Regular Expression Print.

# Search recursively in current directory
grep -r "TODO" .

# Search literal string (faster), showing line numbers
grep -rnF "processPayment" src/

# Exclude node_modules
grep -r "API_KEY" . --exclude-dir=node_modules

Find: locating files

# Find all JavaScript files modified in last 24 hours
find . -name "*.js" -mtime -1

# Find and delete node_modules (careful!)
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +

Sed: Stream Editor

Perfect for bulk changes.

# Replace 'http' with 'https' in all files
sed -i 's/http:/https:/g' config.js

# Print lines 10 to 20
sed -n '10,20p' file.txt

Awk: Text Processing

When you need to process columns of data.

# Print second column (PID) of processes named 'node'
ps aux | grep node | awk '{print $2}'

# Sum a column of numbers
cat expenses.txt | awk '{sum += $1} END {print sum}'

Custom Aliases

Add these to your .zshrc or .bashrc:

# Git shortcuts
alias gs='git status'
alias gc='git commit -m'
alias gp='git push'

# Easy navigation
alias ..='cd ..'
alias ...='cd ../..'

# Safety
alias rm='rm -i' # Ask before deleting

Useful Tools

  1. htop: Better Process Manager
  2. curl/httpie: API testing
  3. jq: JSON processor
  4. fzf: Fuzzy finder

JQ Example

# Pretty print JSON
curl https://api.github.com/users/octocat | jq .

# Extract specific field
curl ... | jq '.name'

Bash Scripting Basics

Create deploy.sh:

#!/bin/bash
set -e # Exit on error

echo "Building..."
npm run build

echo "Deploying..."
aws s3 sync dist/ s3://my-bucket

echo "Done!"

The terminal isn't scary—it's the fastest way to talk to your computer. Learn one new command a week.

linuxterminalproductivitydevopsbash
Share this article
T

Written by

TechGyanic

Sharing insights on technology, software architecture, and development best practices.