Navigating the Linux Filesystem - page 2
Let's go back to that filesystem in Figure 1, where we'd gotten as far
as /home. But you can string together more than one directory in a
pathname. You know that /home gets you one level below the root;
but if you add another directory, you can refer to useful places
/home/sue. On most systems, that's where the user
named sue would have her home directory. So when Sue first
logs in, her working directory is her home directory,
Remember I said how important it is whether you start with a slash? Suppose Sue has a directory of her own called "home", where she keeps all the records related to her house. If she's in her home directory and types "ls home", that's very different from "ls /home", as Figure 2 illustrates.
$ ls /home fred sue $ ls home mortgage.ods paintcodes.odf photosSee the difference?
Now let's say, going back to Figure 1, that Sue wants to
share a photo of her dog with Fred, who has an account on the same
system. All she has to do is tell him the full pathname to the photo
There's a shortcut, though. You can use the tilde character, ~, to
refer to home directories. A tilde by itself means your own home
directory: if Sue wants to edit the Fido photo in GIMP, she can say
The ~ stands for /home/sue in any command Sue types.
When Fred types a ~, though, Linux will look in /home/fred instead.
If Sue wants to tell Fred where to find her Fido photo, she should
use the slightly longer form "~sue", which means "the home directory of
user sue", or /home/sue. So she gives Fred the pathname:
~sue/Pictures/pets/fido.jpg, and Fred can use that from
Of course, Fred can't necessarily read Sue's files, and vice versa -- there are ways of protecting your files so no one else can see them. But that's a topic for another day!
Sponsored by BlackBerry
BlackBerry® Enterprise Server Express enables businesses of any size to quickly and easily get started with the BlackBerry solution. It provides advanced BlackBerry smartphone features with no additional software or user license fees, and works with any Internet-enabled BlackBerry data plan or a BlackBerry enterprise data plan. Download now!