nic
10/24/2014 - 4:40 PM

Unix Commands

## Delete all files with exceptions
find . -not -name "wp-config.php" -not -name ".htaccess" -not -name "mytar.tar.gz" -exec rm -rf {} \;

## Create tar file excluding all from .tarignore
tar -c --exclude-from=.tarignore -vzf myfile.tar.gz *

## Create tar file without ._ files and excluding other files
COPYFILE_DISABLE=true tar -zcvf mytarfile.tar.gz --exclude='myfile.php' *

## Extract tar file
tar -xvf myfile.tar.gz

## Create zip file excluding all unneseccary files
zip -vr myfile.zip folder-to-zip -x '*.DS_Store*' -x '*.dropbox*' -x '*.git*' -x '*._*' -x '*.tarignore*' -x '*/node_modules/*' -x '*.psd' -x '*.ai' -x '*.eps'

## Edit hosts file
sudo nano /private/etc/hosts

## Remove .DS_Store (or other) files from directory
find . -name '*.DS_Store' -type f -delete