MacOS · Technical · Today I Learned

Terminal Commands to Improve Productivity on Mac

Open any IntelliJ Idea editor from current folder. (Change PhpStorm to your editro’s name)

open -a PhpStorm ./

GIT – Reset uncommitted changes and files

git reset --hard && git clean -fd

Sublime Text – Create a CLI launcher

ln -s "/Applications/Sublime" ~/bin/subl

Save Aliases

If you don’t want to remember these, you can add these to your ~/.bashrc or ~/.zshrc file.

# edit hosts file
alias edithosts='subl /etc/hosts'

# reset git folder
alias nah='git reset --hard && git clean -fd'

# open current folder in idea editor
alias storm='open -a PhpStorm .'

# clear DNS history
alias cleardns='sudo killall -HUP mDNSResponder'

# NPM install
alias ni='npm install'

After you update ~/.bashrc or ~/.zshrc, run the applicable command in terminal to load the changes.

source ~/.bashrc
// OR
source ~/.zshrc