Bash cheat sheet

Finding, searching in, replacing in files
find. -type d -name child -delete

Looping input into variable
cat myFile | while read x ; do echo $x ; done

cat myFile | while read x y ;  do echo $y $x ;  done

while read x y ; do echo $y $x ; done < myFile

test=`echo "hello world" | { read test; echo $test; }`

using a here string $ read a b c <<< $(echo 1 2 3)

Editing
CTRL + T Switch positions of current and previous characters

Alt + T Switch positions of current and previous words

Alt + U Change the current word (from cursor position to end of word) to uppercase

Alt + L Change the current word (from cursor position to end of word) to lowercase

Alt + C Change the current character to uppercase

CTRL + H Delete the character before the cursor. Similar to pressing backspace

CTRL + V Add a special character. e.g. CTRL+V

CTRL+C will add ^C instead of canceling the current command

CTRL + _ Undo Alt + Backspace Deletes from cursor position back to the first space

Cutting and Pasting
CTRL + K Cut text from cursor position to the end of the line

CTRL + U Cut text from cursor position to the beginning of the line

CTRL + W Cut word from cursor position to the beginning of the word

ALT + D Cut word from cursor position to the end of the word

CTRL + Y Paste the recently cut text

References

http://codehill.com/2012/08/shortcut-keys-for-bash/#.UCH0M2PmjEs.reddit