Bash

When you have a hammer, everything looks like a nail

bash

Why I love my hammer, the shell? Simply to get the job done, without any GUI get in the way.

The following are few of my fav hammer. It's only 'the tip' of the bash hammer.

All batteries included within your MacOS, or Linux.


Compare directories

Quick compare content of two directories.

diff -rq DIRECTORY1 DIRECTORY2

Find any string

Find any string, within any files, buried within layers of directories.

grep -rsniH 'lalala yeyeye' *

Copy/sync everything to anywhere

If you move tons of files, here and there, then rsync is your friend. But remember, rsync --dry-run is also your best friend.

Basic:

rsync -avhP --delete SOURCE/ DEST

Over SSH:

rsync -avhP [SOURCE FOLDER/FILES] user@server:/PATH/ON/DESTINATION

Over SSH with private key:

rsync -avhP -e "ssh -vv -i YOURKEY" username@HOST:~/remote/directory/ localdirectory

Go crazy, exclude list of files with --exclude-from 'file-list.txt'

The exclude file list understand 'space', wildcards, and regex statement

*.txt
[dD]esktop.ini
Temporary Items

(Ref:link).