Files, Directories, and the Root of All Things

There's a saying in the Linux world that "everything is a file" (a comment attributed to Ken Thompson, the developer of UNIX). That includes directories. Directories are just files with lists of files inside them. All these files and directories are organized into a hierarchical file system, starting from the root directory and branching out.


Folders and directories are the same thing. The terms can be used interchangeably. I tend to think of them as directories, but if you are more comfortable thinking of them as folders, don't worry. Depending on the application, you'll see both terms used.

The root directory (referred to as slash, or /) is aptly named. If you consider your file system as a tree's root system spreading out below the surface, you start to get an idea of just what things look like. Under the root directory, you'll find folders called usr, bin, etc, tmp, and so on. Let's open Nautilus and have a look at this structure.

Click Places on your top panel and select Home Folder. This brings up the file browser in your home folder. If your navigation panel isn't up (Nautilus' left side panel), press <F9> to open it. You'll see a number of entries, including your home directory. On the left, Nautilus shows a small list of important places on your system, primarily in your home folder. This side panel is the navigation panel. Pressing <F9> hides (or brings forward) the navigation panel. Beside the Places label, there is an arrow, alerting you to the fact that this is actually a button with a drop-down list of options. Click that button now and select Tree for your view. In all likelihood, you'll see two entries: one for Home Folder and another for File System. To the left of each entry is a small arrow. Click the one beside File System (or double-click the folder) to get a top-down view of your Ubuntu Linux system (see Figure 4-1).

Figure 4-1. Nautilus, the GNOME file browser, with a top-down view of the Ubuntu Linux file system. This view is selected from the navigation panel on the left.

On the right, the contents of the current place (or location) are displayed. If this is a directory (like your home directory), the various directories will appear as folder icons. These are all system directories, and they will contain all the programs that make your Linux system run, including documentation, devices, and device drivers. For the most part, you aren't going to be touching the files under File System. Accidentally changing things around in this part of your system probably isn't a good thing (it could render your system inoperative), which is why everyone logs in with their own accounts.


When you look at your files and folders in Nautilus, they are arranged alphabetically. Usually, this is what you want, but you can also sort them by size, modification date, file type, and more. Just click View on the Nautilus menu bar and check out the Arrange Items submenu. You can even choose to arrange them manually.

One of the directories under the root is called home and inside that directory, you'll discover other directories, one for each login name on your system. These are the individual home directories, and it is where you'll find your personal files and directories. If you want to store personal documents, music files, or pictures, this is the place. Once you are in Nautilus, you can jump to your home directory by clicking the Home icon or clicking Go on the menu bar and selecting Home (keyboard jockeys can just press <Alt+Home>). This is your $HOME.

Quick Tip

My use of $HOME isn't just to be silly. The system can recognize some things based on environment variables, symbolic names that can refer to text, numbers, or even commands. In the DOS/Windows world, you had similar variablesfor instance, the PATH in your AUTOEXEC.BAT file. $HOME is an environment variable assigned to every person who logs in. It represents a person's home directory. If you want to see all the environment variables assigned to your session, shell out and type the following command:


Try this. Over on the left side of the Tree view, click the small arrow beside the home directory. As you saw earlier, the Tree view expands to show the folders in your own personal directory. Notice that the right-pointing arrow is now a down-pointing arrow. If you click it again, the directory view collapses. With the home directory expanded, click your personal directory. You should see a few items appear in the right-side view, including one icon labeled Desktop. For an example, see Figure 4-2. On the left side, the home folder is expanded, and the right-side view shows the same folder collapsed.

Figure 4-2. Expanding and collapsing folders in Nautilus' Tree view.

Before you do anything else, I want you to reopen Nautilus in your home folder (click Places and select Home Folder). There's a very special folder there called Desktop. Now, look down in your bottom panel, over on the far left side of the screen. Do you see the Desktop icon there? It looks like an old-fashioned desktop blotter with a pencil and a piece of paper on it. Pause your mouse cursor over it, and the tooltip displays Click Here to Hide All Windows and Show the Desktop. Click it, and your desktop appears, free of windows. Click it again, and everything returns to normal.

Now, I'm going to briefly jump ahead in the book and have you create a folder on your desktop. Right-click anywhere on that empty desktop and a pop-up menu appears. The top entry in that menu is Create Folder. Click that and a folder appears on your desktop with the label Untitled Folder beneath it (see Figure 4-3). Type in a name and press <Enter>.

Figure 4-3. To create a folder on the desktop, right-click and select New Folder. Then, change the name of the untitled folder.

I am having you do this because I want you to remember something later when I have you create icons on your desktop. The desktop you are looking at when you work with your Ubuntu system is that Desktop folder in your home directory. If you create a folder on the desktop, use Nautilus to view your home folder, and then double-click the Desktop folder, you will see your newly created folder in the Desktop folder. The same is true for image files or songs or video clips. If it's on your desktop, it's in the Desktop folder. Even those icons on your desktop are files or directories. Cool? Let's move on.

Shell Out

Open a terminal shell by selecting Terminal from the Accessories submenu under the top panel Applications menu. At the shell prompt, type ls Desktop. The ls command lists the contents of your Desktop directory. Compare what you see there with the icons currently on your graphical desktop. Do the names look familiar? When you are done, type exit to close the terminal.

Directories (and subdirectories) usually show up as folders, although this isn't a hard and fast rule because you can customize this. Nevertheless, some directories have different icons right from the startthe Desktop icon you just visited being one of them.

Moving to Ubuntu Linux
Moving to Ubuntu Linux
ISBN: 032142722X
EAN: 2147483647
Year: 2004
Pages: 201

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: