Ctrl + a
– go to the start of the command lineCtrl + e
– go to the end of the command lineCtrl + k
– delete from cursor to the end of the command lineCtrl + u
– delete from cursor to the start of the command lineCtrl + w
– delete from cursor to start of word (i.e. delete backwards one word)Alt + b
– move backward one word (or go to start of word the cursor is currently on)Alt + f
– move forward one word (or go to end of word the cursor is currently on)Alt + d
– delete to end of word starting at cursor (whole word if cursor is at the beginning of word)Ctrl + r
– search the history backwardsCtrl + g
– escape from history searching m
!!
– run last command!$
– the last word of the previous command (same as Alt + .)!$:p
– print out the word that !$ would substitute!*
– the previous command except for the last word (e.g. if you type ‘find some_file.txt /‘, then !* would give you ‘find some_file.txt‘)!*:p
– print out what!*
would substitute
# find and copy/rename
find ./xxx -iname 'some.json' -exec sh -c 'cp "{}" other-path/"$(basename "$(dirname "{}")")"/some.json' \;