TidBITS#666/10-Feb-03
=====================

  Apple seems to be on a weekly hardware release cycle these days,
  with last week's release of the "Spring Line" of flat-panel
  iMacs (along with eMac price drops) and this week's release
  of new Xserves. We examine both, but devote the bulk of the
  issue to Kirk McElhearn's tutorial on navigating via the
  command line. In TidBITS news this week, find out how you
  can get pre-publication chapters of Adam's iPhoto book and
  see him this week in New York City.

Topics:
    MailBITS/10-Feb-03
    Apple Revs Xserve and Introduces Xserve RAID
    A Mac User's Guide to the Unix Command Line, Part 2

<http://www.tidbits.com/tb-issues/TidBITS-666.html>
<ftp://ftp.tidbits.com/issues/2003/TidBITS#666_10-Feb-03.etx>

Copyright 2003 TidBITS Electronic Publishing. All rights reserved.
   Information: <[EMAIL PROTECTED]> Comments: <[EMAIL PROTECTED]>
   ---------------------------------------------------------------

This issue of TidBITS sponsored in part by:
* Make friends and influence people by sponsoring TidBITS! <--------- NEW!
   Put your company and products in front of tens of thousands of
   savvy, committed Macintosh users who actually buy stuff.
   For more information and rates, email <[EMAIL PROTECTED]>.

* READERS LIKE YOU! Help keep TidBITS going via our voluntary <------ NEW!
   contribution program. Our thanks this week to Arnie Rodman,
   Kenneth Russell, and JoAnn Vincent Pedersen for their support!
   <http://www.tidbits.com/about/support/contributors.html>

* SMALL DOG ELECTRONICS: iMacs plus AppleCare Sale! <---------------- NEW!
   iMac G4/700 w/Combo: $1,210 | iMac G4/800 w/Superdrive: $1,479
   iMac G4/800 512/Superdrive: $1629 - All with AppleCare!
   <http://www.smalldog.com/tb/> 802/496-7171

* DEALMAC: 256 MB PC100 DIMMs for $25 each. <------------------------- NEW!
   <http://dealmac.com/articles/47245.html?ref=tb>
   DEALMAC: Palm Tungsten T for $360 shipped.
   <http://dealmac.com/articles/47263.html?ref=tb>

* easyDNS: Worried about your ISP going under? Get lifetime email <-- NEW!
   and web addresses with easyDNS's DNS-Plus package. Change ISP's
   or web hosting companies anytime YOU want. Take control.
   easyDNS: the way things should work. <http://www.easyDNS.com>

* SIX DEGREES puts your email back to work for you. It eliminates <-- NEW!
   the need to refile email or search for that elusive message.
   Your email isn't going away, so you may as well put it to work.
   ========> <http://www.creo.com/sixdegrees/index.asp?id=tidbits>

* Fun, sexy, and fierce, TEKKA is a new subscription Web magazine <-- NEW!
   about enjoying new media and creating beautiful software.
   Serious reading, for serious readers. Elegant code, serious
   writing, putting fun back in the link. <http://www.tekka.net/>.
   ---------------------------------------------------------------

MailBITS/10-Feb-03
------------------

**Bit of Numerology** -- We hit these triple identical digit
  issues of TidBITS every couple of years, but this is one of the
  most notable, since 666 is the so-called "number of the beast"
  from the Bible's Book of Revelation (Chapter 13, verse 18). But
  the number has additional meaning in the Macintosh world, where
  $666.66 was the initial price of the Apple I and where the now-
  relevant Unix command chmod 666 unlocks certain problematic files.
  It turns out the number has many other mathematical properties,
  as you can read at Mike Keith's page on the topic. I particularly
  like the last one. [ACE]

<http://www.htmlbible.com/kjv30/B66C013.htm>
<http://users.aol.com/s6sj7gt/mike666.htm>


**Apple Releases New iMacs, Lowers eMac Prices** -- Continuing the
  push to update its product line for AirPort Extreme and Bluetooth,
  Apple last week unveiled the latest revisions to its flat-panel
  iMac line. The new 17-inch iMac starts at $1,800 and boasts a 1
  GHz PowerPC G4 and a 133 MHz system bus, 256 MB of DDR SDRAM
  (expandable to 1 GB), and a 4x SuperDrive (CD-RW/DVD-R), along
  with slots for an AirPort Extreme card (an extra $100), and an
  internal Bluetooth module (an extra $50). The 15-inch iMac
  receives only a speed bump to an 800 MHz PowerPC G4 and a $200
  price drop to $1,300. Unfortunately, it's not capable of taking
  an AirPort Extreme card (though the slower 802.11b AirPort card
  remains an option) and can use only a USB-based Bluetooth adapter.
  Simultaneously, Apple announced price cuts - but no new features -
  for the 17-inch CRT-based eMac, which now costs $1,000 with a
  Combo drive (CD-RW/DVD-ROM) or $1,300 with a SuperDrive. [ACE]

<http://www.apple.com/imac/>
<http://www.apple.com/emac/>


**Get Pre-Publication iPhoto 2 VQS Chapters** -- As the latest in
  my efforts to experiment with various approaches to electronic
  publishing, I will be making available for download each chapter
  in my forthcoming book, iPhoto 2 for Mac OS X: Visual QuickStart
  Guide. Most people who use iPhoto have probably upgraded to iPhoto
  2, but I see no reason why people who want to buy the book should
  wait for all the unavoidable aspects of print publishing
  (especially for international readers) that delay the arrival
  of a book. So here's the deal. If you pre-order my iPhoto 2
  book on Amazon, from Peachpit, or any other source, and send
  your receipt to <[EMAIL PROTECTED]>, I'll send you the
  instructions for getting each chapter in PDF format as soon as
  I finish writing and Tonya finishes editing. I'll also add you
  to a mailing list that will receive announcements when I upload
  a new chapter. At the end, I'll post the entire book as a single
  PDF with the bookmarks and links that can make an electronic book
  even more useful than a physical copy. And of course, when the
  paper copy comes out, it will arrive on your doorstep as soon
  as possible.

  A few notes about different retail outlets: Since I'm handling
  all this myself ("if you want something done right..."), it
  really doesn't matter where you choose to pre-order the book
  as long as you can send me a receipt via email. However, I've
  noticed that Amazon is not yet discounting the $20 book their
  usual 20 to 30 percent, so you'll pay a bit more there right
  now. Other booksellers may offer a discount and reasonable
  shipping rates. [ACE]

<http://www.amazon.com/exec/obidos/ASIN/0321197763/tidbitselectro00/>


**Adam Speaking at NY City Area User Groups This Week** -- On
  Thursday, 13-Feb-03 at 6:30 PM, I'll be speaking at the monthly
  MetroMac meeting at New York University, and on Friday, 14-Feb-03
  at the Long Island Macintosh Users Group (LIMac) at the New York
  Institute of Technology. At both meetings I'll be talking about
  the most interesting products and events from Macworld Expo in
  San Francisco and answering questions about wireless networking,
  iPhoto 2, and anything else people want to ask. I should have
  signed copies of my books to raffle off, and I'll be happy to sign
  copies you already have. And yes, since Friday is Valentine's Day,
  that meeting will be a family affair: Tonya and Tristan are coming
  to the LIMac meeting. Directions to the meeting locations for both
  are on the groups' Web sites. [ACE]

<http://www.metromac.org/>
<http://www.limac.org/>


**Digital Photography Cruise in June** -- Alaska in June is a
  fabulous place for outdoor photography thanks to its gorgeous
  scenery and great evening light from the longest days of the year.
  If you're interested in honing your digital photography skills,
  you might want to check out the upcoming Digital Photography
  Workshop at Sea with lead instructor Arthur Bleich, who
  contributes to TidBITS on digital photography topics. [ACE]

<http://www.dpcorner.com/cruise/>


Apple Revs Xserve and Introduces Xserve RAID
--------------------------------------------
  by Adam C. Engst <[EMAIL PROTECTED]>

  Leaving the iBook as the only part of Apple's product line that
  hasn't recently received a significant update (hint, hint), Apple
  today announced new models of their industrial strength Xserve 1U
  rack-mount servers (see "Apple Introduces Xserve Rack-Mount
  Server" in TidBITS-631_). Simultaneously, Apple introduced the
  Xserve RAID, a 3U rack-mount 2Gb Fibre Channel box that can hold
  up to 14 Apple Drive Modules for a total of 2.52 terabytes (TB) of
  storage. Apple had originally promised the Xserve RAID would be
  available by the end of 2002, but the company backtracked toward
  the end of the year. Both the new Xserve models and the Xserve
  RAID will be available in March.

<http://db.tidbits.com/getbits.acgi?tbart=06828>

  Competing as they do in the big business world of data centers,
  the Xserve and Xserve RAID will live and die by their specs, and
  Apple has provided what look like impressive numbers.


**New Xserves** -- The new models feature either one or two 1.33
  GHz PowerPC G4 processors with 256K of on-chip Level 2 cache
  running at the full 1.33 GHz speed and 2 MB of Level 3 cache, all
  using a 167 MHz system bus. They come with either 256 MB or 512 MB
  of PC2700 DDR RAM running at 333 MHz (upgradable to 2 GB via four
  DIMM slots), and one 60 GB ATA/133 drive module (with a maximum of
  720 GB possible by filling the four hot-swappable drive bays with
  180 GB drive modules). Also new are a pair of FireWire 800 ports
  on the back panel that join the standard two USB ports and a DB-9
  serial port; the front panel offers a single FireWire 400 port.
  Dual independent Gigabit Ethernet is still standard, as is a
  PCI-based ATI video card (an AGP 4x ATI Radeon 8500 can replace
  the Ethernet card in the combo PCI/AGP slot). You can now choose
  a Combo drive (CD-RW/DVD-ROM) instead of the standard CD-ROM
  drive. As before, a copy of Mac OS X Server with unlimited clients
  runs the Xserve. The single processor model starts at $2,800 and
  the dual processor model at $3,800, both a drop of $200 from the
  slower models they replace.

<http://www.apple.com/xserve/>
<http://www.apple.com/pr/library/2003/feb/10xserve.html>

  A few notable things have not changed. The new models do
  not support either AirPort Extreme or Bluetooth, but neither
  technology makes much sense for a rack-mounted server. The Xserve
  still lacks dual power supplies, which some people have longed
  for, and maxes out at 2 GB of RAM, rather than the 4 GB or 8 GB
  that some high-end installations need.

<http://db.tidbits.com/getbits.acgi?tlkthrd=1655+1703>


**Xserve RAID** -- Apple's new Xserve RAID connects to the Xserve
  via the $500 dual channel 2 GB Apple Fibre Channel PCI Card.
  Rather than use pricey Fibre Channel drives, the Xserve RAID
  relies on inexpensive 7200 RPM ATA/100 drive modules that can be
  hot-swapped into the 3U rack mount enclosure that converts ATA
  to Fibre Channel. Each 3U enclosure can hold up to 14 Apple Drive
  Modules (the same hot-swappable modules used in the Xserve itself)
  for a total of 2.52 TB. For reliability, the Xserve RAID offers
  optional Cache Backup Battery Modules that Apple claims provide
  more than 72 hours of backup power to protect data in the RAID
  controller during a power outage; dual independent RAID
  controllers, redundant cooling modules; and dual, redundant,
  hot-swappable power supplies.

<http://www.apple.com/xserve/raid/>
<http://www.apple.com/pr/library/2003/feb/10xserveraid.html>

  The Xserve RAID may cost less than other high-end hardware RAIDs,
  but it's still not exactly cheap: 2.52 TB costs $11,000 (about
  $4 per GB), though you can buy 1.26 TB for $7,500 and 720 GB for
  $6,000. In terms of RAID levels, the Xserve RAID supports RAID 0
  (striping), RAID 1 (mirroring), RAID 3 (striping with parity),
  RAID 5 (striping with distributed parity), and RAID 0+1 (striping
  over mirroring). That's all in hardware; software RAID in the
  Xserve adds RAID 10, 30, and 50, which is striping across multiple
  RAID 1, 3, or 5 sets.


**Slow Start, but Great Expectations** -- The Xserve hasn't been
  a barn-burner in terms of sales and didn't even meet Apple's
  projections in the second quarter of 2002, its first quarter of
  sales, Still, the Gartner Group said Apple shipped 5,700 units
  in the U.S. in the third quarter of 2002, good for a 1.2 percent
  market share that was three times better than the previous year's
  third quarter. And in the fourth calendar quarter of 2002, Apple
  said it shipped 6,000 Xserves. Those numbers don't sound like
  much, but the market for high-end servers is much smaller than
  for desktop computers (in a year, Apple alone ships nearly as
  many Macs in the U.S. as the total U.S. server sales from all
  companies).

<http://www3.gartner.com/5_about/press_releases/2002_10/pr20021028b.jsp>

  Nonetheless, the Xserve has received generally glowing reviews
  from publications that are seldom enthused about anything from
  Apple. The prices are competitive, the software is a tremendous
  value (it would cost $1,000 on its own), and there's no question
  that Apple has improved the Xserve in welcome ways. Dual power
  supplies may be unreasonable in a 1U case - there simply isn't
  much extra room in there - but it would be good to see Apple
  raising the upper limits on RAM in a future revision. But you
  already know if those limitations are a problem for your needs;
  for most people who need a server, a rack-mounted Xserve is an
  impressive package, particularly for the price. I hope to be
  ordering one soon for our next generation of TidBITS server
  infrastructure.

   PayBITS: Did Adam's Xserve research and reporting help make up
   your mind about whether or not the Xserve is your next server?
   <https://www.paypal.com/xclick/business=ace%40tidbits.com>
   Read more about PayBITS: <http://www.tidbits.com/paybits/>


A Mac User's Guide to the Unix Command Line, Part 2
---------------------------------------------------
  by Kirk McElhearn <[EMAIL PROTECTED]>

  Lesson 2: Navigating the File System

  In the first installment of this series, we looked at the basics
  of using the Terminal to access Mac OS X's Unix core. What's next?
  Well, when you visit a new place, the first thing you need to
  learn is how to get from one location to another. So, let's look
  this time at how you use the Terminal to move around your Mac's
  file system. (You might want to go back and read the previous
  article again to refresh your memory before continuing.)

<http://db.tidbits.com/getbits.acgi?tbart=07003>

  As you are certainly already aware, your files are organized in a
  hierarchy of directories (the Unix word for folders). When moving
  around in the Finder, you open folders, which display other
  folders and files, and you drag, copy and paste files and folders
  among the windows that the Finder displays. In the Unix world,
  you navigate among directories using commands, displaying lists
  of files and directories, and you move, copy and paste files and
  directories from the command line.

  In most cases, you're probably better off using the Finder for
  your everyday activities. But navigating the file system with
  the Terminal can have a few advantages:

* It's fast. You can jump from one directory to another in a
  split-second, as long as you know its path. There's no need
  to open window after window to get where you want.

* It's informative. While you can access most of the same
  information from the Finder - such as file permissions - the
  Terminal displays these details more quickly. For example, you
  can use the Finder's Get Info window to learn the permissions
  for an entire folder of files, but you must do so individually
  for each file. With the Terminal, you can display a list showing
  permissions for all the files instantly.

* It's complete. You can access invisible files and directories
  that aren't accessible via the Finder (without special utility
  software). In most cases, you're better off leaving these files
  and directories alone, but if you need to see or work with
  invisible files and directories, the Terminal may be the best
  way to go.


**Navigating the Mac OS X File System** -- Mac OS X, like most
  other operating systems, uses a file system to organize files
  and folders. The basic principle behind this system is that of
  hierarchy: at the top of the hierarchy is a single point (called
  the "root" of the file system, indicated by / in Unix systems),
  and below that point, a tree structure spreads out from directory
  to sub-directory.

  In the Finder, you can easily see tree structure by looking at a
  window in column view. Open a new Finder window, choose View > As
  Columns, click on your startup disk, then Users, and then your
  user name. You should see at least eight folders in the fourth
  column. You're looking at the contents of your Home folder. Each
  of its sub-folders can contain other files and folders, and so on.

  The rest of this article will show you how to move around in your
  Mac's file system using the Terminal. You will learn how to
  display the contents of a directory, how to change directories,
  and how to determine where you are.

  Bear in mind that whenever you open the Terminal you are at a
  specific location in the file system. Unless you've modified
  how the Terminal works on your Mac (at which point you probably
  don't need these articles), you will always begin in your Home
  directory, the one with your user name (such as mine, called
  kirk). No matter what you do in the Terminal, you are always
  someplace.


**Finding Where You Are with pwd** -- When traveling, you
  sometimes need to look at a map to find where you are. The same
  goes for the Terminal. The pwd command (print working directory)
  does just that by telling the Terminal to display the full path
  to the current working directory.

[Walden:~] kirk% pwd
/Users/kirk

  I left the complete prompt visible in the above example to show
  you the difference between the directory information visible in
  the prompt (the ~) and what pwd displays. The only difference is
  that my user's Home directory is replaced by the ~ shortcut. But
  look at the next example. When I'm outside my Home directory,
  there's no difference between what is shown in the prompt and
  what pwd returns.

[Walden:/Library/Preferences] kirk% pwd
/Library/Preferences


**Listing Directory Contents with ls** -- The ls command (list
  directory contents) is one of the most useful and commonly used
  commands for navigating the file system. You're used to seeing the
  contents of folders when opening new windows in the Finder; when
  you move to a new directory in the Terminal, you see nothing. The
  Terminal only displays the contents of a directory after you tell
  it to with the ls command.

  When you are in your Home directory, and run the ls command, you
  should see something like this:

% ls
Desktop    Library  Music     Public
Documents  Movies   Pictures  Sites

  The ls command returns a simple list of the current working
  directory's contents, but nothing in this list tells you anything
  about what these items are. Luckily, the ls command offers a
  plethora of options on how to display the contents of a directory,
  and what type of information is shown.


**Viewing the Contents of a Different Directory** -- The ls
  command displays the contents of the current working directory
  (the one the Terminal is in) if you do not add the name of a
  directory to the command as an argument. You can list the contents
  of any directory on your computer, as long as you know its path.
  To do this, you must specify the full path of the directory. For
  example, if you want to list the contents of the /Library/Fonts
  directory, enter the following:

% ls /Library/Fonts
Arial               Cochin.dfont    HelveticaNeue.dfont
Arial Black         Comic Sans MS   Hoefler Text
Arial Narrow        Courier New     Optima.dfont
[etc.]

  You must use the complete path of the directory /Library/Fonts/,
  because you are specifying an absolute file path. However, you can
  also use ls to display the contents of directories using relative
  file paths. When in my Home directory, I can display the contents
  of the Pictures directory by simply entering the following:

[Walden:~] kirk% ls Pictures/
iPhoto Library        white background.jpg

  As you can see from the prompt, I am still in my Home directory
  (~). If you don't specify an entire file path beginning with /, ls
  assumes you want to start from the current working directory.


**Viewing the Entire Contents of a Directory** -- The basic ls
  command displays the contents of a directory in a simple manner.
  But what this command doesn't tell you is that there are other
  items in the directory. In fact, every Mac OS X directory contains
  invisible items, either files or folders. To view the entire
  contents of a directory, use the ls command with the -a option.
  (Note that options go _before_ the directory path, if you're
  listing the contents of a specific directory as discussed
  just previously.)

% ls -a
.                    .Trash                   Desktop
..                   .addressbook             Documents
.CFUserTextEncoding  .addressbook.lu          Library
.DS_Store            .lpoptions               Movies
[etc.]

  Your Home directory may contain different files, but many of
  them are the same. As you can see, there are a series of files
  beginning with . (dot). This dot indicates that a file is
  invisible, and the ls -a command displays all files, including
  invisibles. While you won't need to access most of these files
  (and messing with some of them could be harmful to your system),
  you can see them and know they are there. (Later in this article,
  when examining the cd command, we'll see what . and .. do.)


**Viewing Long Information** -- Another option to the ls command, -l
  (that's a lowercase L), returns much more complete information
  on the contents of a directory, going much further than what you
  can find out from the Finder's Get Info command. If I run ls -l in
  my Home directory, the Terminal returns the following information:

% ls -l
total 0
drwxr-xr-x   3 kirk  staff   102 Nov  9 11:22 Applications
drwxr-xr-x   8 kirk  staff   272 Nov 11 14:46 Desktop
drwxr-xr-x  24 kirk  staff   816 Nov 11 13:07 Documents
drwxr-xr-x  44 kirk  staff  1496 Nov 10 22:49 Library
[etc.]

  When you use ls with the -l option, the following information is
  displayed:

* The first line shows the number of 512-byte blocks used by files
  in the directory. In this example, there are no files - only
  directories - so it reads total 0.

* The first part of each line shows the file or directory's
  permissions.

* The next part is a number, showing the number of file system
  links the file or directory uses.

* Then comes the user name. In the above example, I am in my Home
  directory, so all the files belong to me.

* Next is the group the user belongs to. In this case, I belong
  to staff.

* The next number is the size of files in bytes, or the number of
  directory entries. This number is useful for files; the directory
  number is less useful.

* The date and time shown correspond to the last time the file or
  directory was modified. If the file has not been modified in the
  last year, the date and year are shown.

* Finally, the name of the file or directory is shown.

  If you use ls -l in other locations, you may see additional
  information:

* Items belonging to other users, such as root.

* Additional groups, such as wheel, unknown, and admin, in
  addition to staff.

* Some items contain -> in their names. These are symbolic links,
  similar to Mac OS aliases. For example, var -> private/var is a
  symbolic link pointing from var to private/var.

  While the ls -l command shows the size of files, there are some
  cases where this figure is incorrect. Adding the -s option adds a
  column, at the left of the list, showing the number of 512-byte
  blocks each file takes up on disk. Look at the following example:

% ls -ls
328 -rw-r--r--  1 kirk  staff  30819 Nov 14 18:06 Perceval.jpg
 64 -rw-r--r--  1 kirk  staff  30819 Nov 14 18:07 PercevalCopy.jpg

  These two files seem to have the same size (30819 bytes) but the
  first file takes up much more space on disk. This is because the
  first file, a picture, has an additional resource that the
  Terminal does not see. This thumbnail takes up much more space
  than the actual file, and the Finder clearly shows the difference
  in size. But the Terminal does not unless you use the -s option.


**Changing Directories with cd** -- When navigating your Mac's
  file system in the Finder, you have two choices: you can either
  have the Finder open a new window when you open a folder, or it
  can open the new folder in the same window. When working in this
  second way, you always have just one window open, and you can go
  backward and forward in your file system hierarchy, but always
  within the same window.

  Moving around in the Terminal works in this second way: no matter
  where you move to, you are always "in" one directory. As we saw
  above, the Terminal prompt tells you which directory you are in,
  and the pwd command tells you where you are in the file system
  hierarchy. So, remember that, when navigating the file system in
  the Terminal, you are always in one location.

  The cd command (change directory) moves you from one directory to
  another. In Unix lingo, it changes the working directory; this is
  the directory in which you are located, and the one in which you
  can act on enclosed files or directories without specifying a file
  path. Let's start by looking at the following:

[Walden:~] kirk% ls
Desktop    Library  Music     Public
Documents  Movies   Pictures  Sites

  The above shows the contents of my Home directory after executing
  the ls command. To move to the Library directory, type the
  following and press Return:

% cd Library
[Walden:~/Library] kirk%

  The prompt changes to reflect the current working directory.
  (If you need to move into a folder whose name contains more than
  one word, enclose the folder name in quotes.) Then, to see what
  it contains, type ls and press Return.

% ls
Addresses              FontFavorites.plist    Preferences
Application Support    Fonts                  Printers
Assistants             Fonts (Disabled)       Recent Servers
Audio                  Frameworks             Screen Savers
[etc.]

  You can move into one of these directories with cd:

% cd Addresses
[Walden:~/Library/Addresses] kirk%

  And, look at its contents, using ls:

% ls
Address Book.addressbook  Addresses.addressBook

  At this time, you may have forgotten where you are in your file
  system. Use the pwd command to learn your location:

% pwd
/Users/kirk/Library/Addresses

  You can now use the cd command to move back up in the hierarchy by
  running cd with the complete file path of the folder you want to
  move to. Say you want to go back to the Users/ directory; use the
  following:

% cd /Users
[Walden:/Users] kirk%

  The prompt shows that you are in the Users directory. If you want
  to go back to the Library directory, where you were before, you
  could type the following:

% cd /Users/kirk/Library/
[Walden:~/Library] kirk%

  If you attempt to move into a directory that does not exist, or
  if you misspell the name of a directory, you see this message:

% cd Proust
Proust: No such file or directory.


**Using the Finder to Save Time in the Terminal** -- While you may
  think that the Finder and the Terminal are mutually exclusive, the
  two can work together to save you time. Sometimes, you may need to
  type a lot to get into a deeply nested directory, but it's a cinch
  to navigate there in the Finder. If you want to move into a
  directory using cd, type cd [space] in the Terminal. Then switch
  to the Finder, look for the folder you want to move to, and drag
  that folder into the Terminal window. The Terminal adds the path
  of the item you drag to the command you just typed.

[Walden:~] kirk% cd /Users/kirk/Library/Preferences

  Press Return, and that directory becomes your current working
  directory.

  You can do the same thing to act on a file. Just type the
  beginning of the command you want to use (don't forget to type
  a space before dragging the file), then locate the file in the
  Finder, and drag it to the Terminal window.


**Going Home in a Jiffy** -- It may seem as though using the cd
  command requires a lot of typing, and in its basic usage, that
  can be true. However, cd also offers many shortcuts to let you
  navigate quickly and easily through the file system. The most
  useful shortcut is to type just cd, then press Return, which we
  do while our current working directory is the Addresses directory,
  as you can see in the prompt below.

[Walden:~/Library/Addresses] kirk% cd
[Walden:~] kirk%

  As you can see from the second prompt, cd by itself takes you
  to your Home directory. (Remember, the tilde character (~) is a
  shortcut for the current user's Home directory.) The reason for
  this shortcut is that Unix assumes most users will only be working
  in their Home directory or one of its sub-directories. For this
  reason, the tilde (~) shortcut for your Home directory also lets
  you move easily to sub-directories within your Home directory. If
  you want to move to your Documents directory, you can type the
  following no matter where you are:

% cd ~/Documents
[Walden:~/Documents] kirk%

  Using the ~ shortcut helps save you from typing the full file path
  of the Documents directory.


**Upstairs Downstairs** -- Every directory in your file system
  contains at least two entries. When you create a new, empty
  directory, these two "files" are automatically added to them.
  They are . (dot) and .. (dot dot). Look at the following:

% mkdir New_Directory
% cd New_Directory
% ls -a
.  ..

  In the first line above, I created a new directory, and, in the
  second line, I moved into that directory. I then ran the ls -a
  command, which displays the contents of that directory; the -a
  option shows invisible files. You can see that the only files in
  this new directory are . (dot) and .. (dot dot).

  These two files are useful. The first one, . (dot), represents
  the current working directory, and can save you time in certain
  commands involving files within that directory. The second one, ..
  (dot dot), is a shortcut to the parent directory, or the next
  directory up in the file system. No matter where you are in the
  file system, you can always type the following:

[Walden:~/Documents/New_Directory] kirk% cd ..
[Walden:~/Documents] kirk%

  As you can see from the prompts in this example, typing cd ..
  takes you up to the parent directory of New_Directory, or
  Documents. Any time you move into a sub-directory, using the cd
  command, you can use cd .. to back up. But you can also move up
  the file system from the current directory until you reach the
  top. Look at the following:

[Walden:~/Documents] kirk% cd ..
[Walden:~] kirk% cd ..
[Walden:/Users] kirk% cd ..
[Walden:/] kirk%

  As you can see in the prompts, I was in my Documents folder, then
  moved up three times to reach the root level of the file system,
  or /.

  You can now combine the cd .. command with cd - to move up and
  down in the file system, but, remember, the cd - command only
  moves back one step. There is no simple equivalent (in the cd
  command) to move down the file system to where you started.

[Walden:/Users] kirk% cd ..
[Walden:/] kirk% cd -
[Walden:/Users] kirk%

  In the first line, I moved up from /Users to /; in the second
  line, I moved back to the previous working directory, /Users.


**Opening a Directory in the Finder** -- Sure, the Terminal lets
  you move around quickly and easily, yet all but the most die-hard
  Unix fans will eventually yearn to see icons again. Wherever you
  are in the Terminal, no matter what directory you are in, you can
  run the following command at any time to open the current working
  directory in a new window in the Finder:

% open .

  You will recall that . (dot) represents the current working
  directory. The open command lets you open many kinds of items just
  as if you double-click them. The open command even lets you open
  directories that are normally hidden from view by the Finder, thus
  giving you the best of both worlds.


**Home Again** -- This article showed you how to move around
  your Mac's file system, and how to see what its folders (or
  directories) contain. You learned about how the Mac OS X file
  system works, and saw some of the differences between what you
  see in the Finder and what Terminal shows you. You discovered
  some of the basic commands for navigating your computer, which
  are the command-line equivalents of double-clicking folders and
  reading their contents:

* pwd: tells you where you are.
* cd: takes you into another directory.
* ls: shows you what your directories contain
* open: opens a directory in a new window in the Finder.
* You also learned how to use the ~ (tilde) character as a
  shortcut for your Home directory.

  In the next installment, you'll learn how to move and copy
  files, how to create directories, and how to delete files and
  directories, rounding out the basics of command-line navigation.


  [Kirk McElhearn is a freelance writer and translator living in a
  village in the French Alps. This article is an excerpt from his
  forthcoming book, Unix for Mac OS X: Learning the Command Line, to
  be published by Addison-Wesley in September 2003.]

<http://www.mcelhearn.com/unix.html>

   PayBITS: Did this article help you dip your toes into Terminal?
   Consider supporting Kirk with a few bucks via PayPal!
   <https://www.paypal.com/xclick/business=kirk%40mcelhearn.com>
   Read more about PayBITS: <http://www.tidbits.com/paybits/>




$$

 Non-profit, non-commercial publications may reprint articles if
 full credit is given. Others please contact us. We don't guarantee
 accuracy of articles. Caveat lector. Publication, product, and
 company names may be registered trademarks of their companies.

 This file is formatted as setext. For more information send email
 to <[EMAIL PROTECTED]>. A file will be returned shortly.

 For information: how to subscribe, where to find back issues,
 and more, email <[EMAIL PROTECTED]>. TidBITS ISSN 1090-7017.
 Send comments and editorial submissions to: <[EMAIL PROTECTED]>
 Back issues available at: <http://www.tidbits.com/tb-issues/>
 And: <ftp://ftp.tidbits.com/issues/>
 Full text searching available at: <http://www.tidbits.com/search/>
 -------------------------------------------------------------------






Reply via email to