wiki:UsefulMacShellCommands

This page contains useful commands or scripts which apply to Mac OS X.

Create RAM Disk

Create a RAM Disk of size 500 MB and with name "MyRamDisk" if it doesn't exist.

#!/bin/sh

# Please set the name here -- SUGGEST NOT to contain white-space.
VOL_NAME=MyRamDisk

if ! test -e /Volumes/${VOL_NAME} ; then
  # unit: count of 512-block, so '500*1024*2' means 500 MB
  diskutil erasevolume HFS+ ${VOL_NAME} `hdiutil attach -nomount ram://$((500*1024*2))`
  # 
  mkdir -p /Volumes/${VOL_NAME}/Firefox
else
  echo 'RAM Disk already exist.'
fi

Package folder with password and exclude DS_Store files

zip -ery <NEW_FILE_NAME>.zip <NAME_OF_FOLDER_TO_BE_PACKED> -x "*.DS_Store"

Notes:
  -e : encrypt
  -r : recurse-paths
  -x : exclude files
  -y : symlinks # TBD what does it really mean? "symbol link" in Windows ?
Last modified 4 years ago Last modified on Nov 11, 2014, 3:01:27 PM