Shell Script

  • asdf - Extendable version manager with support for Ruby, Node.js, Elixir, Erlang & more

Cheatsheets

Check if command exists or not.

if !(command -v go); then
    # Do something 
fi

Check if folder exists or not.

if ! test -d "$BUILD_FOLDER"; then
  mkdir $BUILD_FOLDER
fi

Archive

Extract tar.gz

tar -xvzf filename.tar.gz

Generate password

Generate random password from terminal.

openssl rand -hex 12 
# sample result: e5d7c5f2da0147f9d90cb055
openssl rand -base64 12
# sample result: KXkGq9elKBfTz+8H

Open sublime text from terminal in MacOS

Create binary symlink using this comamnd.

sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl