Skip to content

Instantly share code, notes, and snippets.

@truetone
Last active November 7, 2017 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save truetone/2ab2d9965719ff76f97d to your computer and use it in GitHub Desktop.
Save truetone/2ab2d9965719ff76f97d to your computer and use it in GitHub Desktop.
Handy cli stuff

Handy cli stuff

Generate password (install pwgen first)

pwgen -Cs 20 1 | tr -d ' ' | tr -d '\n' | pbcopy

Moving around

Erase word

ctrl-w

Erase from here to beginning of the line

ctrl-u

Move the cursor to the beginning of the line

ctrl-a

Move cursor to the end of the line

ctrl-e

Recursive find and replace

find . -type f -name '*.html' -exec sed -i '' 's/pattern\/to\/find/pattern\/replacement/' {} +

Convert file to UTF-8 encoding

iconv -f iso-8859-1 -t utf-8 < file > file.new

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment