Snow Leopard Command Line Hacks

Here are my favorite command line hacks that enable special features or views in OS X 10.6 Snow Leopard.

  • Enable Quick Look Folder Previews
    defaults write com.apple.finder QLEnableXRayFolders 1
    Once you’ve entered this command, restart Finder (killall finder or ctrl+option+click Finder Dock Icon, and Relaunch), select a folder, and hit the space bar.
  • Enable AppleScript Studio Palette
    defaults write com.apple.InterfaceBuilder3 IBEnableAppleScriptStudioSupport -bool YES
    OS X 10.6 Snow Leopard allows you to work on AppleScript Studio Projects, but you can’t create new ones. Run the above command to add it back into Interface Builder.
  • Disable Focus Follows Mouse
    defaults write com.apple.Terminal FocusFollowsMouse -string NO
  • Confine Dictionary To One Window
    defaults write com.apple.Dictionary ProhibitNewWindowForRequest -bool TRUE
  • Change iTunes Green Maximize Button Functionality
    defaults write com.apple.iTunes zoom-to-window -bool YES
    During the initial launch of iTunes 9, the green + icon on the window bar maximized the iTunes window instead of alternating to the mini player. Use this command line hack to enable this functionality once again.
  • Automatically Play Movies in QuickTime X
    defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen 1
  • Keep QuickTime Full Screen While Switching Applications
    defaults write com.apple.QuickTimePlayerX MGFullScreenExitOnAppSwitch 0
  • Disable QuickTime Rounded Corners
    defaults write com.apple.QuickTimePlayerX MGCinematicWindowDebugForceNoRoundedCorners 1
  • Automatically Show Closed Captioning or Subtitles in QuickTime
    defaults write com.apple.QuickTimePlayerX MGEnableCCAndSubtitlesOnOpen 1
  • Make List View Stacks Function Like Grid View Stacks
    defaults write com.apple.dock use-new-list-stack -bool YES
  • Enable MouseOver Highlight in Stacks
    defaults write com.apple.dock mouse-over-hilite-stack -boolean yes
    Once typing in this command, restart Dock (killall dock) to view changes.

Create a Text File of Directory Contents

If you’ve ever needed to get a list of files in a specific directory for whatever purpose, maybe you need to verify files during a backup or transfer, you probably hunted for a good freeware application to do the trick. Sure, there are good options out there, but why find a download for something you can just as easily accomplish from the command line?

Running the following command will output a list of the contents of the current directory to your Desktop. Just replace YOU with your Windows username.

dir /b *. > C:\Users\YOU\Desktop\musicfiles.txt

It’s that easy!

Enable Stacks Mouseover Highlight (OSX 10.6)

Enabling automatic mouseover highlighting of icons in your grid stacks makes browsing for files that much easier, and it’s just a simple command away. It’s been changed from the original command in Leopard, so after opening Terminal, run these commands:

  1. defaults write com.apple.dock mouse-over-hilite-stack -boolean yes
  2. killall dock

When the dock restarts, you can check out your fancy new highlight by clicking on your grid stack’s icon!

Disable SSH Known Host Checking

We’ve all ran into this annoying message when using ssh to connect to more than one computer behind the same IP address.

Offending key in /root/.ssh/known_hosts

And we all know that deleting the offending line in that file will solve our problems, but doing it every time is such a hassle, and if you need to do this on a constant basis, you really can’t be doing this every time. Well, a quick change to your SSH’s configuration file will do the trick!

Open the file /etc/ssh/ssh_config in your favorite text editor, and add the following two lines below Host * in the configuration file.

StrictHostKeyChecking no
UserKnownHostsFile /dev/null

This will disable strict host checking, and automatically write the known hosts to a black hole. You will never be disturbed by that prompt again!

NOTE: If your network security isn’t extrapolated from this process somehow, you probably don’t want to disable this check.

Windows 7 Super User Guide

We’ve all seen the countless top 10 articles, shortcut guides, etc out for Windows 7, but what really separates this new release from the rest of the Windows herd? Listed here are several features I believe sets Windows 7 above and beyond all previous releases.

Display Projection Management
Along with the standard Presentation Mode that was already available in Windows Vista, you can now control the output settings of your secondary display with a few keystrokes! Just hit WINDOWS KEY + P to bring up the Display Projection dialog and choose whether you would like to duplicate or extend your display, or only show output on your main or secondary display. AWESOME!

Better Font Management
No longer is it a complete pain in the ass and total waste of time to preview and install fonts. Microsoft has integrated an Install button right into the preview interface, so now you can add fonts to your library with one click if you like them, instead of navigating every time to your fonts directory and dragging and dropping the files over. Microsoft also grouped different weight classes for the same fonts into the same preview window for faster comparison, as well as adding support for more than the four standard weights in the “Font Style” dialogs.

Better Standards Support
Windows 7 includes bigger, better, and beefier versions of our age old favorites, Paint and Wordpad. What most articles fail to mention is that Wordpad is capable of reading and saving documents in both the new Word 2007 Office Open XML and the OpenDocument Specification that IBM and Sun have been touting about.

Better Media Support
Windows 7 plays nice with most video codecs right out of the box. Yeah, you can just double click a movie file and it will open in WINDOWS MEDIA PLAYER. I’m not joking! Certain videos still require downloading the appropriate codecs, but you can install Shark007′s Windows 7 Codec Pack and never think twice. Not only that, but you can also burn ISO files right in Windows Explorer, just double click your ISO file, insert a blank disc, and click Burn!

Power User Hot Keys

  • WINDOWS KEY + HOME
    Minimize all other windows behind active window.
  • WINDOWS KEY + SHIFT + (LEFT OR RIGHT)
    Shift active window to the desktop to the left or right of active desktop.

How to Install FFMPEG On Centos (Yum)

Installing ffmpeg is really easy with the YUM package manager, so don’t fret!

Shell in, or open up your terminal, and execute the following command:

yum install ffmpeg ffmpeg-devel

If you see an error stating package not found, then you probably need to add a repository. We can do that with vi in the same terminal window:

vi /etc/yum.repos.d/dag.repo

Once vi is open, press i to go into INSERT mode, and paste the following text in:

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

Press ESC to exit out of INSERT mode and then hold SHIFT and press Z Z to save. (Or, of course, :wq to write and quit.) You can now add the GPG key for the repository:

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Once that is complete, run the yum install command again. After installation is complete, you can run this command to test if FFMPEG is installed and working correctly:

ffmpeg -i Input.file Output.file

How Can I Test My SMTP Server

Are you unsure if you setup Postfix correctly, or you seem to be able to connect, but mail isn’t going through? You can telnet into your SMTP server and run a direct mail test from the console.

If you’re on Windows, open a command prompt. If you’re on Mac or Linux, open up a Terminal window. Once you’re ready, you can follow along.

telnet [server ip] 25

When you’re successfully connected, enter these commands line by line, hitting return after each line.

EHLO
MAIL FROM: test@testemail.com
RCPT TO: [your email here]
DATA
[your message here]
.

When you enter a period on a line by itself, the SMTP server will attempt to send the mail out. Once it’s sent, you can type quit and hit return to exit the SMTP console, and verify the mail actually got to you!

Can’t Open Network and Sharing Center

I’ve never ran into this issue on Windows Vista or Windows 7 on my own computer, but my roommate had a problem with their new laptop where trying to access the Network Adapters or Network Connections dialogs would just result in a hang and you would have to close the window. When trying to automatically connect to a wireless network, the loading icon didn’t even spin, it just sat there. Really quirky, right?

Well, I found a couple suggestions on the world wide webs, and here’s what worked for me, a simple one liner in the command prompt, a quick registration of a DLL file, and BAM, they were back online!

Open a command prompt with administrator privileges and type this in:

regsvr32 netcenter.dll

Once you hit the ENTER key and it returns with a success message, give your computer a restart and you should be back online.

If this didn’t work for you, you can try to reboot into safe mode (reboot and hit f8 while your computer is booting up, and select safe mode from the menu) and once you are in, open a command prompt with administrator privileges and type this in:

net localgroup “Administrators” “local Service” /add

Once you’ve entered it in and you see a success message, reboot your computer and cross your fingers!

json_encode Does Not Exist

It’s broken because the JSON module for php isn’t installed and/or loaded! So, install it!

  1. Install the PHP Developer Package
    yum install php-devel
  2. Compile the JSON PHP Module with PEAR or PECL (PEAR Recommended)
    PEAR » pear install pecl/json
    PECL » pecl install json
  3. Configure PHP to Load JSON PHP Module
    Create a file json.ini in the directory /etc/php.d/ with this line:
    extension=json.so

See, that wasn’t that hard, was it?

Giving Away A Google Wave Invite

I was recently invited to the Google Wave sandbox, and even more recently doubled up on the amount of invites I have available.

So, I would like to extend an invitation to a reader of Cubicle Generation. What’s the catch, you say?

I want to know what you guys would like me to write about next, what interests you?

Let me know what you would like to see in upcoming blog posts, and I will pick my favorite out of all the submissions this upcoming Monday (November 9th) and announce the winner of the Google Wave invitation!