Sharing Files in Linux and Understanding Pathnames
Going Dotty in the Linux Filesystem
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:
ls -a (a in this case stands for "all").
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
pwd to make sure). Another
cd .. and you'll be in /, the root directory.
This is particularly useful since you can string them into longer pathnames. If you're in /usr/bin and you type
cd ../lib, you'll end up in /usr/lib: from /usr/bin, .. means one level up, or /usr. It may not seem that useful just to get from /usr/bin to /usr/lib, but just suppose you were in /usr/lib/gimp/2.0/plug-ins and you wanted to get to /usr/lib/gimp/2.0/scripts. Rather than typing that whole thing out, just type
cd ../scripts and you're there.
What about the single dot?
. means the current directory. So
cd . doesn't do anything; it just leaves you in the same place you already were.
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.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Debian Dumps SPARC, Ubuntu Takes Over Linux 3.13 and the Core Infrastructure Initiative