Macintosh users may be a minority, but they are quite loyal to their operating system and loathe to give it up. Mac OS stores its files in HFS (hierarchical file system) format, which uses a return character to separate lines in text files, rather than a newline character as in Linux/UNIX. If you have files on a Macintosh floppy disk that you wish to get on your Linux system, several options are available.
Just as “m” commands deal with DOS disks, “h” commands work for Macintosh disks. These commands are named and behave just as any Linux user might expect. For example, to change directories on your Linux system, you type cd path; to do so with a Mac volume, you type hcd path. In other words, you just add an “h” as the first character of the command name. In some cases, the base command name is taken from DOS rather than UNIX—I guess to make the h tools consistent with the m tools. The most frequently used h utilities are:
hcd path: change working directory on the disk; default is the root (/) directory
hdel names: delete a file or files on the disk
hcopy source destination: copy a file to or from an HFS disk
hdir: list the files on the disk; hls also works for this purpose
hmkdir path: create a directory on the disk; hrmdir removes a directory on the disk
hmount device_name: mount the HFS disk at this location; humount unmounts the disk
Other available commands are hformat, hpwd, hrename, hvol and hatrib. For details on these HFS utilities and their options, see the man pages.
Wild cards are permitted in specifying path names, but be aware that if you use “*” to mean “every file in the directory”, it will not be interpreted that way. For example, typing hcopy * . will look for the filenames on the HFS floppy in the current directory , instead of getting all the files off the HFS floppy as you would expect.
Another method for manipulating Mac disks is the hfs shell. This shell, based on Tcl, provides the same type of options as the h commands: mount (m), umount (u), cd (c), dir (d), mkdir (m), rmdir (r), etc. The difference is only in the way the command is specified. For example, to mount the disk with hfs, you type:
hmountFinally, Robert Leslie's program xhfs provides a graphical user interface to the hfs commands. It is easy to use and quite intuitive. Just type:
xhfsand up pops a window displaying available options (see Figure 1). A click of the mouse on the button next to the option you want, and you are on your way to having those files on your system in Linux format.
If a friend sends you a Macintosh file, don't forget you need to get rid of those pesky return characters. The tr command (see “A Little Devil Called tr” by Hans de Vreught, LJ, September 1998) is the best tool for doing this. Typing
tr '\015' '\012' <
will do the trick.
Another good resource for these commands and others is Linux for Dummies Quick Reference, 2nd Edition by Phil Hughes.
|Bitcoin on Amazon! Sort of...||Sep 28, 2016|
|Free Today: September Issue of Linux Journal (Retail value: $5.99)||Sep 27, 2016|
|nginx||Sep 27, 2016|
|Epiq Solutions' Sidekiq M.2||Sep 26, 2016|
|Nativ Disc||Sep 23, 2016|
|Android Browser Security--What You Haven't Been Told||Sep 22, 2016|
- Free Today: September Issue of Linux Journal (Retail value: $5.99)
- Bitcoin on Amazon! Sort of...
- Android Browser Security--What You Haven't Been Told
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Nativ Disc
- Identity: Our Last Stand
- Epiq Solutions' Sidekiq M.2
- The Many Paths to a Solution
- Securing the Programmer
Pick up any e-commerce web or mobile app today, and you’ll be holding a mashup of interconnected applications and services from a variety of different providers. For instance, when you connect to Amazon’s e-commerce app, cookies, tags and pixels that are monitored by solutions like Exact Target, BazaarVoice, Bing, Shopzilla, Liveramp and Google Tag Manager track every action you take. You’re presented with special offers and coupons based on your viewing and buying patterns. If you find something you want for your birthday, a third party manages your wish list, which you can share through multiple social- media outlets or email to a friend. When you select something to buy, you find yourself presented with similar items as kind suggestions. And when you finally check out, you’re offered the ability to pay with promo codes, gifts cards, PayPal or a variety of credit cards.Get the Guide