General, not OSX-specific or linux-specific, and see also shells to yak-shave your way into whole other shell paradigms. Or fish for a less awful user experience.
I just don’t care enough to remember. This makes me a Bad Hacker.
Command line tips
See command lines which are mostly bash specific because everything is hard in bash.
!n– the nth history,
!stringrefers to the most recent command in the history starting with string,
!?string[?]refers to the most recent command containing string
Sensible history search
whack this in
set meta-flag on set input-meta on set output-meta on set convert-meta off "\ep": history-search-backward "\en": history-search-backward "\e[A": history-search-backward "\e[B": history-search-forward $if Bash Space: magic-space $endif
Vars, expansions, filenames, whitespace hell
Tilde expansion is complicated. Best to avoid tildes and use
files extension munging in bash
Don’t forget the quotes, or it will explode when you have spaces in your filenames and delete stuff that you loved. (I hate
bash so hard. I should probably abandon it.)
Watch out for horrible problems with handling of delimeters. Anyway, for loops are not insane.
Init file madness
Weird bash syntax errors about ‘end of file’.