Use mac-oriented ditto instead of cp. ditto = copy files and directories ls = list directory cd = change directory store shell scripts in ~/bin set a script to be executable with +x chmod +x ~/bin/backup.sh