CLI commands that let you access meta data of all files in OSX

Apple, CLI, Lion, Mountain Lion, OSX, osx Server, spotlight, Tip, Tricks
Two small commands with huge possibilities: mdls  usage: mdls [-name attr] [-raw [-nullMarker markerString]] [-plist file] pathlist the values of one or all the attributes of the specified file -raw: don't print attribute names before values -nullMarker: substitute this string for null attributes in raw mode -plist: output attributes in XML format to file. Use - to write to stdout option -plist is incompatible with options -raw, -nullMarker, and -nameexample: mdls ~/Pictures/Birthday.jpgexample: mdls -name Keyword ~/Pictures/Birthday.jpg mdfind Usage: mdfind [-live] [-count] [-onlyin directory] [-name fileName | -s smartFolderName | query] list the files matching the query query can be an expression or a sequence of words -live Query should stay active -count Query only reports matching items count -onlyin <dir> Search only within given directory -name <name> Search on file…
Read More

Get Control of Mountain Lion with a huge list of command line tweaks…..

Apple, CLI, Lion, Macintosh, Mountain Lion, OSX, osx Server
As pointed out to me in the comments the original Author -- Mathias Bynens -- is constantly updating this document. You can find the latest up to date version at http://mths.be/osx # ~/.osx — http://mths.be/osx ############################################################################### # General UI/UX # ############################################################################### # Set computer name (as done via System Preferences → Sharing) scutil --set ComputerName "MathBook Pro" scutil --set HostName "MathBook Pro" scutil --set LocalHostName "MathBook-Pro" # Menu bar: disable transparency defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false # Menu bar: show remaining battery time (on pre-10.8); hide percentage defaults write com.apple.menuextra.battery ShowPercent -string "NO" defaults write com.apple.menuextra.battery ShowTime -string "YES" # Menu bar: hide the useless Time Machine and Volume icons defaults write com.apple.systemuiserver menuExtras -array "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" "/System/Library/CoreServices/Menu Extras/AirPort.menu" "/System/Library/CoreServices/Menu Extras/Battery.menu" "/System/Library/CoreServices/Menu Extras/Clock.menu" # Always show scrollbars defaults write…
Read More

Create a Mountain Lion Install DVD or USB Drive after App Store purchase

Apple, Macintosh, Mountain Lion, OSX, osx Server
Once you've purchased Mountain Lion from the App Store, follow these steps to create a backup install DVD or flash drive Download Lion from the Mac App Store—but don't install it yet, because of the disappearing installer issue noted above. Find the installer in your Applications folder and right-click on it then select "Show Package Contents." Head to Contents and SharedSupport and look for the file called "InstallESD.dmg" Open up Disk Utility from your Applications and Utilities folder and drag the DMG file into the sidebar on the left. If you're burning to DVD: insert your disk, select the DMG file in the sidebar, and hit "Burn." Skip to step 6. If you're burning to USB, you'll need to first format the drive properly: Insert the disk and select it…
Read More

SSH to your remote machine using Back to My Mac iCloud Service

Apple, CLI, Macintosh, OSX, osx Server, ssh, XServe
This is kinda cool. It only works if you have access to "Back to My Mac" service and you have it turned on in the remote mac's preferences (under iCloud preferences). If you ever need to find out the FQDN (Fully Qualified Domain Name) of your remote mac and connect to it via ssh or something like it you can use the following command in the terminal: echo show Setup:/Network/BackToMyMac | scutil | sed -n 's/.* : *\(.*\).$/\1/p' This should spit out the "domain name" for your "personal" iCloud DNS. The output looks something like this: 12345678.members.btmm.icloud.com To use this in a ssh command you would need the name of the remote machine plus the information above: ssh -2 -6 remote-hostname.12345678.members.btmm.icloud.com That's it…..you should see a prompt for ssh login…
Read More