Skip to content

Instantly share code, notes, and snippets.

@denitram
Last active December 28, 2017 12:02
Show Gist options
  • Save denitram/443f6d49c03ff591776a11af9a5668f3 to your computer and use it in GitHub Desktop.
Save denitram/443f6d49c03ff591776a11af9a5668f3 to your computer and use it in GitHub Desktop.
bash handy tips
#--- Commandline history substitution
* Replace old by new in prevous command
^old^new
^old^new is equivalent to !!:s/old/new
* Replace globally
!!:gs/old/new
#--- Batch renaming file
* Rename something001.txt to 001.txt, something002.txt to 002.txt...
for f in *.txt; do mv "$f" "${f#something}";done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment