72 words — 1 minutes read

Handy Unix commandlines

It’s hard to memorize all the fun things you can do with the shell on a *nix system.

Here’s my crib-sheet: Find all files containing string in the current directory tree

find . -type f -exec grep string {} ; -print

In all files in directories dir1 and dir2, replace “aaa” with “bbb”


for i in `find ./dir1 ./dir2 -type f`; do
    sed -e"s/aaa/bbb/g" $i> $i.$$
    mv $i.$$ $i


Jens-Christian Fischer

Maker. Musician