Working with the Linux File System


As the Internet has just a few specific but well-known top-level domains (.com, .net, .org, .edu, and the like), so are Linux files organized in a particular hierarchy, with specific directories that hold specific types of files.

Virtually all Linux distributions have the same structure, and this is likely to become more entrenched with the Linux Standard Base specifications becoming more universal. The Linux Standard Base (www.linuxbase.org) is an effort to make all Linux distributions more compatible with each other, and with most applications. SUSE is a longtime supporter of this effort, and has been compliant with LSB standards since LSB v1.0. In addition, the Filesystem Hierarchy Standard seeks specifically to standardize the contents of the top-level Unix/Linux directories. This structure is beautiful for software developers because they can know what directories will be present on each user's machine and can install programs into the appropriate directory. It also enables programmers to build more modular programs, which depend on other standard libraries. It helps packaging systems such as the Red Hat Package Manager (RPM) that SUSE uses check and confirm that a file on which a package depends is present on a user's system. Testing goes easier, too, because fewer things can go wrong.

We went over that structure briefly in Chapter 2, "Preparing to Install SUSE Linux." To have another look and get your first lesson in using a shell, open the KDE Konsole and type ls /. You should see the following:

bin    dev    home    media    opt    root    srv    usr    windows boot    etc    lib    mnt    proc    sbin    tmp    var 

For a more detailed view of the file system from the shell, use the tree command. This program might not be installed by default, but it is on the CD-ROM. The results displayed by this program include all the top-level directories listed in "How to Partition Your Drive(s)" in Chapter 2, along with a few levels of subdirectories.

Note

When you're typing into the KDE Konsole, you're using the bash shell in an X Terminal (or Xterm). You'll learn more about shells and terminals, including how to change the defaults, later in the chapter.


In Windows, you have the capability to create, delete, and rename as many top-level directories and subdirectories as you want, and very few bad things can happen to you as a result. Renaming the Program files or Windows directories would cause problems, but the system won't come to a halt if you installed a program to a directory outside of Program files. Although you have the same technical ability to manipulate the directory structure in SUSE Linux, at least if you have Root privileges, don't!

The sole exception to this otherwise ironclad rule is in your home directory. As a user, you can and should organize your documents and other data any way you see fit. You will see several recommendations in this book to put particular files and programs in your home directory because it can be the best place for them. If you find it useful, put every file you create in its own directory (although that might be a little extreme).

This recommendation extends to putting files of your own creation into one of the system directories. Say you create a text file that has a collection of tips and tricks you've learned about the bash shell over the years, called BashTips. Because you know that man pages and other documentation for bash goes in the /usr/share/doc/bash directory, you might be tempted to store the file there. No problem unless somewhere down the road one of the developers or documentation writers adds a BashTips file to the bash package. When that file gets installed, your file is replaced with no questions asked, never to be recovered. No program will ever try to copy a file in your home directory, so put things that are yours there.

Tip

If you ever find the need to have files in two places at once, use symbolic links, usually called symlinks. In the preceding example, keep the file in /home/documents/bash. Then open a shell and type ln -s /documents/bash/BashTips /usr/share/doc/bash/MyBashTips. Now if you look for MyBashTips in this directory, it will open your file. More about this later.




SUSE Linux 10 Unleashed
SUSE Linux 10.0 Unleashed
ISBN: 0672327260
EAN: 2147483647
Year: 2003
Pages: 332

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net