Tinkering with Perl

(Search & Sitemap) > Writing > Miscellaneous Nonfiction > Tinkering with Perl
Skip Back  Previous  3  4  5  6  7  8  9  10  11  12  Next  Skip Forward
Printer-Friendly Version

Directories

Directories in Unix are the same as folders on other machines. They're a place to keep files.

There are four basic commands you need to know about directories: pwd, cd, mkdir, and ls.

Directories are stored heirarchically. This means that there's a top level directory, which contains some directories, and each of those directories may contain some files and some directories, and so on. The full name of a direcory is something like this:

/home/jhayward/perl_guide/text/chapter_0/unix

The slashes ('/') tell where we are. The beginning slash indicates the root directory, the top directory of all; home indicates that I'm in the home direcotory in the root directory, jhayward indicates that I am in the directory called jhayward in the home directory (which is my directory to do stuff in), and so on and so forth.

You may refer to a file or directory by its absolute or relative pathname. If you specify its absolute pathname, you give the full path, all the way from the root directory down to where you are now. If you give a relative path, you tell where it is relative to where you are now. The file I am now editing has absolute pathname:

/home/jhayward/perl_guide/text/chapter_0/unix/directories.html

and relative pathname:

directories.html

from where I am now.

The directory .., in a given directory, is the directory one level up. So the directory

/home/jhayward/perl_guide/text/chapter_0/unix/..

is the same as the directory

/home/jhayward/perl_guide/text/chapter_0/

See also:

pwd - cd - mkdir - ls - Files

Tinkering with Perl is a free book that provides an introduction to programming in Perl, as well as a basic reference for things like foreach in Perl, if-then, and if-then-else, in addition to providing a glossary where you can find definitions for concatenate and other terms.

Tinkering with Perl may be one of the most popular offerings on this site, but it's not the only attraction. You can read a tongue-in-cheek Game Review: Meatspace, read an even more offbeat customer service survey (whether or not you actually fill it out), and spend a few minutes wishing your boss would read, The Administrator Who Cried, "Important!" (Not to mention that there are other things you can read here besides tech stuff, from Janra Ball: The Headache to The Spectacles.)

Read more...

Top

(Search & Sitemap) > Writing > Miscellaneous Nonfiction > Tinkering with Perl
Skip Back  Previous  3  4  5  6  7  8  9  10  11  12  Next  Skip Forward
Printer-Friendly Version