toolkit

Recipes , not theory Each one was run first

xargs turns lines into arguments

printf 'a\nb\n' | xargs -n1 echo

Output:

a
b

-n1 sends one line per command Without it, both lines become one argument list That difference has bitten me more than once

printf beats echo

printf '%s\n' "value with spaces"

echo has flags and version-dependent behavior printf is predictable Use it in scripts

date

date -d - +%Y

Output:

2026

-d parses a date string The format string controls what comes out

Recipe: count unique first fields

cut -d' ' -f1 log.txt | sort -u | wc -l

Recipe: find files by name

find . -name '*.log' -type f

Recipe: keep output and log it

some-command | tee output.txt

End

The shell rewards people who type and check Read less , run more , record what broke

Posted