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"

#SCP AS BG PROCESS: no hang up, pause process using ctrl+z, bg to resume in background
nohup scp -p -r user@ . > nohup.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
zip -er folder1
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
for i in *.heic; do sips -s format jpeg "${i}" --out "${i%heic}jpg"; done

#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 services list
brew services start postgresql@16
brew services stop postgresql@16
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

aws configure list      #list default profile
aws configure           #configure default profile
aws s3 ls
aws s3 ls s3://bucket-name
aws s3 cp ./local-file.txt s3://bucket-name          #no cost
aws s3 cp s3://bucket-name/file.txt ./local-file.txt #network cost
aws s3 rm s3://bucket-name/file.txt


  • Set memory scale - E then e
  • Add new column for threads (nTH)
  • Enter Fields-Management - f
  • Navigate to column RES - down-arrow
  • Set sort by - s
  • Navigate to column nTH - down-arrow
  • Select column - right-arrow
  • Move column up - up-arrow
  • Toggle column selection - d
  • Save settings - W
  • Exit - q