Back to article
Sharing Files in Linux and Understanding Pathnames
Going Dotty in the Linux Filesystem
February 25, 2009
In Navigating the Filesystem I talked about how pathnames work, the difference between /home and home, and using ls to see the contents of a directory. But there are a few more useful tricks you ought to know about finding your way around in the filesystem on your disk.
First, an admission: when you type ls, the system is fibbing to you. There are a lot of files it's not telling you about -- so-called "hidden files". To see them, type:
You'll see a lot of files starting with a period, like .bashrc, .mozilla and so forth. Most of those are configuration files or directories used by programs you run. But at the beginning, you'll also see two curious entries:
These two names act like directories -- you can ls them or cd into them -- but they take you somewhere relative to the directory you're in.
.. is the most useful: it takes you up one level. If you're in your home directory, /home/you, and you type
you'll end up in /home (type a
This is particularly useful since you can string them into longer pathnames. If you're in /usr/bin and you type
What about the single dot?
What good is that? Sounds pretty useless, huh? But it actually does have uses. For one thing, you can use it for programs like find that insist on being told where to start. For another, you can use it when running programs. If you've ever built any programs from source, you might have seen instructions to type "./configure". That means "run the program called configure that's in the current directory, even if there's another program with that name installed somewhere else."
Even if you don't use the . a lot, it's good to know what it means; you'll see it when people talk about Linux commands.