Mac OS Commands

Here's a cheatsheet of some commonly used Mac OS commands. There are too many to list all of them, these just scratch the surface.

md5 -s "my string value"

your-command > dump.out 2>&1 &

ln -s /path/to/source target

curl -I  
curl -L -v > dump.out 2>&1  
curl -x

#ZIP and TAR:
zip -r folder1 folder2  
unzip -l  
tar -zcvf archive.tar.gz folder1 folder2  
tar -ztvf archive.tar.gz  
tar -zxvf archive.tar.gz

find . -type f -name "*Controller.php" -print0 xargs -0 sed -i 's/string1/string2/g'

grep -r -i --exclude='*\.svn*'  "string1" .

find . -type f -name '.DS_Store' -delete  
rm -rf `find . -type d -name .git`  
find . -type d -name .svn -exec rm -rf {} \;

top (shift m)  
cat /proc/meminfo  
free -m

#set JAVA_HOME to 1.7 or 1.8
#  run these commands to see results:
#  /usr/libexec/java_home -v 1.7
#  /usr/libexec/java_home -v 1.8
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

sips -Z 800 *.jpg  
sips --resampleWidth 800 *.jpg

#PHOTO APPEND (ImageMagick):
convert +append  a.jpg b.jpg ab.jpg  //horizontal append  
convert -append  a.jpg b.jpg ab.jpg  //vertical append

brew install ffmpeg  
ffmpeg formats  
ffmpeg -i file.mp4  
ffmpeg -i -vf scale=-2:1080 file.mp4  
ffmpeg -i -qscale 0 -r 30 -y

cd project_dir  
pod init  
vi Podfile  
  platform :ios, '8.0'
  pod 'Firebase/Core'
pod repo update  
pod install/update  
launch XCode using myapp.xcworkspace

brew update  
brew doctor  
brew outdated  
brew upgrade  
brew cleanup  
brew ls -l  
brew ls --versions  
brew search spark  
brew tap  
brew tap homebrew/php  
brew untap homebrew/php  
brew tap caskroom/cask  
brew cask list  
brew install Caskroom/cask/xquartz

sudo chown -R whoami /usr/local  
cd /usr/local  
git fetch origin  
git reset --hard origin/master  

Baldeep Hira

bay area programmer working on mobile/tablet/web apps and enterprise cloud apps; ui/ux, html5 and everything else for a prettier web and world

  • San Francisco Bay Area
comments powered by Disqus