The Linux users' guide to Mac OS X

The command line

So far there's been more that's different than in common between our two OSes, but the similarities become much clearer as soon as you open up the Terminal program found in /Applications/Utilities. Type ls and you'll see a directory listing, just as you'd expect.

Command line

TERMINAL: OS X's Terminal looks pretty much like any other console

Entering pwd will reveal that your home directory is at /Users/username/ rather than /home/username, but that's just a cosmetic difference, especially since refers to the home directory and cd with no argument will return you to it. Try echo $SHELL to show that Bash is your default shell. Which works too, along with the standard shell built-ins and other basic CLI commands.

Locate is also present, but note that to update the database, you'll need to run /usr/libexec/locate.updatedb. You'll need to do this as root and using sudo, because there's no separate root account on a Mac. You can set one up in the Accounts tab of the System Preferences application, which also enables you to set various other system config options.

You won't need it all that often, though – often sudo will do just fine. If you're yearning to know more, man pages are available exactly as they are on a Linux system. This can be particularly useful, because some BSD commands don't work in quite the same way as Linux commands.

For example, grep on OS X doesn't have the --exclude-dir option, which is a nuisance. The Alt+. Bash shortcut to enter the final argument from the previous command line doesn't work on OS X, either, so you'll have to use Esc+. instead.

In general, however, Ctrl does what you'd expect it to on the command line, so you can still use Ctrl+A and Ctrl+E to jump to the start or end of a line. However, this can be slightly confusing given that in graphical apps, the Apple key takes the place of the Ctrl key on Linux. So, for instance, you'd use Apple+W rather than Ctrl+W to close a window.

This is probably to do with the fact that Terminal is more Unix-like than the Aqua environment that lives on top of it and handles all the graphical jobs. When it comes to using X11, which is available for Mac and runs well in OS X 10.5, you'll just have to experiment a bit.

One final neat feature of Terminal is the open command. Type open filename and OS X will fire up the graphical program that's the default handler for that type of file, which saves a lot of time looking for the correct applications.

GUIs and eye candy

You knew it was coming, so here it is: OS X is exceptionally pretty. One of the features that delights Mac users is Exposé, which enables you to hit a button (or move the mouse to a specified part of the screen) and have all your open windows shown at once. There are clones available for Linux, such as Komposé, Skippy and a Compiz Fusion plugin called Scale, which may be worth investigating if you find yourself missing the power of Exposé on your Linux box.

Expose

SHINY UI: Exposé makes picking an app from those you have active easy. It's handy if you're often flipping between tasks

However, they're still not quite as shiny. Some people find the Mac OS X Aqua look and feel is particularly attractive too. You can get Aqua-style themes for Gnome, although the extent to which these make it look like a Mac is a matter of debate.

A really neat GUI trick in Macs is the ability to preview files from Finder. Select the file, hit the Spacebar and a little window pops up with a preview of the file. You can then scroll through the directory, or return to the normal file listing.

Filesystems

The preferred filesystem in OS X is HFS Plus. This has Unix-style file permissions, journalling and extensive file metadata. By default, it's case insensitive but case preserving, although you can choose to format drives to be case sensitive instead.

The default settings can cause problems if you're bringing files over from Linux, because ext2 and ext3 are case sensitive. It's particularly troublesome if you have files that share the same name and are only differentiated by case. OS X can handle the various FAT filesystems and NTFS, but sadly won't deal with ext2 or ext3.

Samba, baby

However, what does work well is NFS and Samba mounting. You should know, though, that as a BSD-based system OS X will use a port numbered above 1024, whereas Linux NFS expects clients to use a privileged network port, which will be less than 1024. There are two ways of solving this.

The first is to add the insecure parameter to the /etc/exports file on the server:

/local 10.1.0.* rw,insecure

If you prefer, and you have only one or two Macs on your network, you could do this to open the access only for those machines in particular:

/local 10.1.0.17 rw,insecure
/local 10.1.0.* rw

The other option is to fix it at the client end, which is probably neater if you're the only one using the Mac. To do this, add -P to the command line via the Terminal.

mount -P server:/local /mnt

The other feature of Mac OS X that's worth mentioning while we're discussing filesystems is Time Machine – the archive and backup system built straight into OS X 10.5 (Leopard). This works like Bacula or any other similar incremental system, backing up changes as often as you define.

However, the advantage of the program over similar offerings is that it's plug and play – once you've set up an external drive as your backup destination, Time Machine will automatically kick off whenever you plug it in. Not only that but the program will then carry on with the scheduled backups until the drive is full or unplugged.

It's probably possible to cobble together something to do this on Linux (using udev and Bacula or a similar incremental system), but on a Mac it's just there, ready and waiting. In short, Time Machine is absolutely fantastic for the backup-obsessed and a great way to help anyone who isn't make sure their backups happen on a regular basis anyway.