05.01.2013 Views

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

some nefarious purpose (although you may find that some Quartz applications utilize these<br />

hidden files to hide something they really don’t want you to find). The main difference<br />

between ls -a and ls -A is that using ls -a will show two special files found in almost<br />

every directory—the . and the ..—which represent the current directory and the directory<br />

immediately above, respectively (these act the same as the . and .. files shown when<br />

issuing a dir command in the Microsoft Windows command prompt). A common ls -a<br />

on a home directory will produce quite a few more files than just a vanilla ls (three times<br />

as many or more is not uncommon):<br />

<strong>Leopard</strong>:~ scott$ ls -a<br />

. .bash_profile Desktop<br />

.. .bashrc Documents<br />

.CFUserTextEncoding .gdb_history Library<br />

.DS_Store .lpoptions Movies<br />

.<strong>Mac</strong><strong>OS</strong>X .parallels_settings Music<br />

.Trash .port_history Pictures<br />

.Xauthority .sqlite_history Public<br />

.adobe .ssh Sites<br />

.bash_history .viminfo<br />

While there are significantly more options available for the ls command, those are the most<br />

common, and should get you started on the right path. You may learn a few other options as you<br />

go along, and later you’ll learn about the man command, which will allow you to learn more<br />

about the ls command (and most others) than you care to know.<br />

Listing a Directory Other Than Your Current Directory<br />

Besides ls’s many options, ls will also accept a directory or file name as an argument. This<br />

allows you to view the contents of any directory without actually moving into that directory, or<br />

explore a single file’s attributes (using the -l option). For example, if I’m in my home directory,<br />

but want to view the files in my Documents folder, I can do this by adding Documents as an argument.<br />

For example:<br />

<strong>Leopard</strong>:~ scott$ ls -G<br />

Desktop/ Library/ Music/ Public/<br />

Documents/ Movies/ Pictures/ Sites/<br />

<strong>Leopard</strong>:~ scott$ ls -G Documents<br />

CDC Baseball/ Personal/ Stuff/ CDCrosters.pdf<br />

Projects/ Work/ Rails/ Writing/<br />

eBooks/ Microsoft User Data/<br />

Furthermore, if I want to find out more about a specific file, I can enter a command like this:<br />

<strong>Leopard</strong>:~ scott$ ls -l Documents/CDCrosters.pdf<br />

-rw-r--r-- 1 scott scott 25739 Apr 24 09:39 Documents/CDCrosters.pdf<br />

Now that you know how to list other directories, the next thing you may want to learn is<br />

how to move into them (virtually anyway).<br />

cd<br />

CHAPTER 18 INTRODUCING DARWIN AND THE SHELL 295<br />

The cd command allows you to move from one directory to another (or as the command implies,<br />

it allows you to change directories). The cd command doesn’t have any options, and only accepts<br />

a path name as its single argument.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!