_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

10 Bash Tricks That Will Save You Hours of Work

08. 10. 2025 2 min read intermediate

Most developers use bash every day, but use barely 10% of its capabilities. Here are 10 tricks that will really save you hours of work per week.

1. Reverse history search (Ctrl+R)

Instead of pressing up arrow a hundred times — press Ctrl+R and start typing part of the command. Bash will search history and offer the most recent match.

Ctrl+R → “docker” → finds last docker command

(reverse-i-search)`docker’: docker compose up -d

2. Brace expansion

Create multiple files or directories at once:

mkdir -p project/{src,test,docs,config}
touch app.{js,css,html}
cp config.yml{,.backup}

3. Process substitution

Compare outputs of two commands without temporary files:

diff <(sort file1.txt) <(sort file2.txt)
diff <(kubectl get pods -n staging) <(kubectl get pods -n production)

4. Xargs for parallel processing

find . -name “*.jpg” | xargs -P 8 -I {} convert {} -resize 50% {}
cat urls.txt | xargs -P 10 -I {} curl -sO {}

5. Bang operators

!! repeats last command. !$ takes last argument. !^ first argument.

sudo !! # repeat last command with sudo
mkdir /tmp/test && cd !$ # cd to just created directory

6. Heredoc pro multi-line stringy

cat << ‘EOF’ > config.json
{
“host”: “localhost”,
“port”: 5432
}
EOF

7. Trap for cleanup

tmpfile=$(mktemp)
trap “rm -f $tmpfile” EXIT

tmpfile is always deleted

8. Parameter expansion

file=”photo.backup.tar.gz”
echo ${file%.tar.gz} # photo.backup
echo ${file##*.} # gz
echo ${file,,} # lowercase
echo ${file^^} # UPPERCASE

9. Set -euo pipefail

Three lines at the beginning of every script:

!/bin/bash

set -euo pipefail
IFS=$’\n\t’

10. Quick calculations

echo $((1024 * 1024)) # 1048576
printf “%’d\n” 1000000 # 1,000,000
echo “scale=2; 100/3” | bc # 33.33

Summary

Each week pick one new trick and use it until it becomes automatic. In a month you’ll be 2× faster in the terminal.

bashlinuxterminalproductivity
Share:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.