Last Updated: February 25, 2016
· pkk

usefull mac terminal shortcuts

Open directory in finder

open .

Pbcopy and pbpaste

grep 'searching for' hugeFile.txt | pbcopy
pbpaste | sed 's/ /%20/g'

mdfind command is the spotlight search from command line

say "Hello there"

The say command invokes the system text-to-speech capabilities.

cd -

Will restore the previous directory you were in. Very handy if you accidentally type cd and flip to home.

And some usefull aliases

alias ..="cd .."
alias ...="cd .. ; cd .."

alias ls="ls -G" # list
alias la="ls -Ga" # list all, includes dot files
alias ll="ls -Gl" # long list, excludes dot files
alias lla="ls -Gla" # long list all, includes dot files

alias stfu="osascript -e 'set volume output muted true'"
alias pumpit="osascript -e 'set volume 10'"

alias ips="ifconfig -a | perl -nle'/(\d+.\d+.\d+.\d+)/ && print $1'"
alias myip="dig +short"