File Organization

team bbl


Files are organized into directories, also called folders. Windows users are probably familiar with folders. A directory can contain files and other directories, as many as needed. A directory can even be empty, containing no files or directories.

NOTE

Because all information on Linux is stored in files, a directory is actually a file that contains the information needed to access the files assigned to it.


Directories are organized in a hierarchy on your hard disk, called a file system. Although technically the directories can be named and organized in any manner desired, most Linux systems are organized in the accepted Linux way. The top directory is called root, designated by a forward slash (/).

When a user account is created, it's assigned a home directory. For instance, the account janet is assigned a home directory named janet. Home directories are located in a directory named home in the root directory /home. Many directories are in the /home directory, one for each user account, such as:

 /home/janet /home/kim /home/theboss 

The directory names above include the names of the directories above them. This designation is called the path. /home is the path from root to janet. If a file named test is in the directory janet, the path is /home/janet, so that the complete name to locate the file is /home/janet/test.

The home directory for the powerful root account is separate from other users, in /root.

You can use shortcuts in the path. A dot represents the current directory; two dots represent the one immediately above the current directory. For instance, in the directory /home/janet, the dot directory is janet and the dot dot directory is home.

The location of a file in the file system includes the path. You can have two files with the same name as long as they are located in different directories.

The entire path from the root directory is called the absolute path. It refers to the total path needed to locate the filethe path from / to the file. A file can also be located by its relative paththe path from the current location to the file. For instance, if you are located in the /home directory, the relative path to the file test is janet/testthe path from /home to the file.

Shortcuts are useful in relative paths. For instance, if you are located in /home/janet, the path to /home/kim can be specified as ../kim.

    team bbl



    Spring Into Linux
    Spring Into Linux
    ISBN: 0131853546
    EAN: 2147483647
    Year: 2005
    Pages: 362
    Authors: Janet Valade

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