Find and execute with pipes:
find . -name \*.erb -print | xargs -n1 rm
Remove recursively custom icons (Mac OS X):
find . -exec setfile -a c {} \;
Remove hidden SVN directories:
find . -type d -name .svn -exec rm -rf {} \;
Relink Symbolic Link:
ln -n -f -s new/destination path/to/link
Combine text files:
cat file1.txt file2.txt file3.txt > all.txt
Count files by extension:
find source/templates/ -type f | sed 's/.*\.//' | sort | uniq -c
Append string to file:
echo "\nto be prepended" >> text.txt
Prepend string to file:
echo -e "to be prepended\n$(cat text.txt)" > text.txt
Bulk change indentation (from spaces to tabs):
find . -name "*.json" | while read line; do unexpand -t 2 $line > $line.new; mv $line.new $line; done
Bulk change indentation (from tabs to spaces):
find . -name "*.json" | while read line; do expand -t 2 $line > $line.new; mv $line.new $line; done
Ruby Command line:
irb
Fix usr/local permissions
sudo chown -R "$USER":admin /usr/local
Clear User Font Cache (Mac OS X):
atsutil databases -removeUser
atsutil server -shutdown
atsutil server -ping
Disable local Time Machine backups (only needed for laptops)
sudo tmutil disablelocal
Jenkins:
Jenkins.instance.getItemByFullName('swiss-feature').builds.findAll { it.previousBuild && (it.previousBuild.timestamp.format('M-d-yyyy') == it.timestamp.format('M-d-yyyy'))}.each { it.delete() }