I have been known to occasionally ask what build number of Mac OS X that someone is using. The sw_vers command can be used to obtain this. Simply run: sw_vers And the BuildVersion will be listed. Or just to get the BuildVersion: sw_vers | grep BuildVersion Or to just get the number (useful in scripts that catalog such a thing: sw_vers | grep BuildVersion | cut -c 15-21 As one comment just indicated, you could also just use `sw_vers -buildVersion`. I guess I should review these commands every operating system or 4… Thanks Allen.
-
-
RDP from the Command Line
Let’s face it, connecting to Windows Servers is a must for many of us. And some of us want to do so programatically. I did look at populating the CoRD database in a previous article. But now, luckily CoRD has recently introduced a command line interface for managing just these types of connections on the fly as well. And, it is very straight forward. There are two ways to call CoRD from the command line. The first is similar to how we handled VNC in an earlier article. Simply leverage the open command and call the URL with a rdp in the beginning. For example, if you want to open…
-
Shell to Clipboard & Back Again
Many times I want to send data straight into the clipboard from a command or script and I don’t really want to have to mess with manually lasso’ing text, using Command-C, etc. What can I say, I’m kinda’ lazy (or working too much, not really sure which). Apple has been kind enough to supply us with a pair of really useful tools for interfacing with the clipboard (er, pasteboard) in Mac OS X: pbcopy and pbpaste. To use pbcopy, which copies text into the pasteboard, simply pipe data to it. For example, if you want to send a directory listing that you run in a script into the pasteboard, you…
-
Lots of new stuff: Command Line Wiki Integration
The Mac Commands page and the PowerShell Commands page are both now wikis and users with accounts on this site can edit them. Additionally I added a number of new pages worth of commands, FTP Commands, Windows Commands, Final Cut Server Commands, Amazon S3 Commands, Podcast Producer Commands and Xsan Commands; both of which are wikis as well.
-
Scripting Compellent
As with EMC, Compellent allows you to manage servers, volumes, server folders, volume folders, views, and of course mappings programatically. This provides the automation minded engineer with a full-on suite for managing their Compellent-based SAN. All of this is made possible using CompCU.jar. I keep a scripts folder and keep the jar file there, which can initially be downloaded from the Compellent site. Unlike a traditional shell script the scripts are to be placed into a text file and replayed against the SAN. If you are using VMware or Xen then you can combine the automation in Compellent along with the automation available with the command line interface for those…
-
Mac OS X: Invoke a Command w/ ScreenSaver
Found this nice little tool called ScriptSaver today. Basically, when the screen saver in Mac OS X is activated and/or deactivated it will run an AppleScript. The AppleScript can call a shell script or you can write an application in AppleScript and choose it from within the script. The developer has also made some sample AppleScripts available for use with ScriptSaver. For my purpose I just wanted to kill Safari, so I used an AppleScript of: tell application "Safari" quit saving no end tell However, I could have just as easily have used
-
pcastaction verbs
pcastaction comes with a number of verbs, each specific to a type of automation that can be used in Podcast Producer. These include: unpack – extract a folder archive before running the automation shell – run a command or shell script preflight – run a script before the automation postflight – run a script after an automation encode – input a standard video file and then output a video file using a different codec annotate – annotate a files metadata qceffect – run a custom Quartz Composer composition against a file watermark – insert a watermark into an indicated video file title – provide a title for the resultant file…
-
php from the Command Line
Using php at the command line isn’t an exact science in regard to which scripts that run in a web page will function from the shell. However, if you are automating many tasks, such as how you would go about with a shell script, then php is a nice alternative to other languages. To get started, let’s look at the version of php that we’re running. A quick way to test this is type the following from the command line. php -v This should result in something like the following message, which includes the version of PHP you are running and the current date: PHP 5.3.0 (cli) (built: Jul 19 2009…
-
Piping Commands
The pipe (|) character is used to combine multiple commands. A pipe is a temporary storage place where the output of one command is stored and then passed as the input for a second command. Pipes are used to run more than two commands from the same command line. The sort command is used to sort data. When you run the ls –l command, you will see a listing of the files in a directory with each file shown on a separate line. When you use a pipe after the command and then sort your results, you will sort the data listed on the screen by the list command. The…
-
Enabling Spotlight for Xsan
Spotlight has had a pretty checkered past with Xsan. But things are looking a little better and if you want to try enabling it again, once you’ve fully updated to 2.2 you can do so without too much fanfare. Simply locate the config file for the name of the volume you wish to enable spotlight for, which is in /Library/FileSystems/Xsan/config and is named with the name of the volume followed by a .cfg file extension. Once located, open the file in your favorite text editor (ie – pico, vi, etc). Then, locate the entry for EnableSpotlight, which should be set to No. Change the No to a Yes. You can…