Handy OSX bash command collection – Part 2254

Note to myself…

The famous ‘locate’ command

 
noship:~ $ # build the 'locate' database (that's different from Linux)
noship:~ $ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

noship:~ $ locate whatever

Create a graphical view of sub folders from the command line

noship:~ $ ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
 :
 |-Documents
 |-Downloads
 |-Library
 |---Accounts
 |---Application Support
 |-----AddressBook
 |-------Images
 :

Securely delete and purge a drive

noship:~ $ diskutil secureErase freespace 3 /Volumes/name-of-drive

Shutdown like a boss

noship:~ $ sudo shutdown -r now

Error Message Texts

noship:~ $ macerror -22
Mac OS error -22 (unitEmptyErr): I/O System Errors

Sources

http://www.mactricksandtips.com/2008/02/create-graphical-view-of-subfolders-in.html
http://www.mactricksandtips.com/2013/05/find-out-the-error-code-of-any-mac-error-message.html
http://computers.tutsplus.com/tutorials/10-terminal-commands-that-every-mac-user-should-know–mac-4825

Leave a Reply

Your email address will not be published. Required fields are marked *