Sunday, January 3, 2010

Lesson 06 Filesystem Principles part 01

Filesystem Principles

In this lesson, you will study Linux file hierarchy principles. You will learn about the contents of some important directories, some rules for naming files and directories, and how to display the current working directory. You will also look at the difference between absolute and relative path names.

Linux File Hierarchy Principles

Filesystem Basics

These Linux file hierarchy concepts will be expanded upon in the pages that follow:

• A single-rooted, inverted-tree structure is used for organizing files and directories, including distinct physical volumes, such as floppy disks, CD-ROMs, and multiple hard drives.

• The base of the inverted-tree hierarchy is known as root, or /, and is the top of the file structure.

• A forward (/) slash separates elements of a path name, for example /usr/bin/X11/X.

• Names in the Linux file hierarchy are case sensitive.

• Each shell and process on the system has a designated current or working directory.

• Two dots (..) refer to the parent directory of any particular directory, which is one level up in the file hierarchy.

• One dot (.) refers to the current directory.

• Files and directories whose names begin with a dot (.) are hidden, that is, they are not displayed by default in file-name listings.

• A user's path is a list of directories that are searched for commands typed at the command line.

Linux uses the forward slash (/) to separate elements of a path name, whereas DOS (Windows) uses a back slash (\).

Present Working Directory

The present working directory is the directory in which you are currently working. To view the present working directory, use the pwd command. When you type the pwd command at the command line, the absolute path to your current working directory is displayed. For example

File and Directory Names
With the default filesystem, file names may have up to 255 characters. (Depending on the configuration of your system, different restrictions may apply.)
File names generally consist of letters, numbers, and certain punctuation marks. All other characters, except the forward slash (/), are valid.
Some special characters are best avoided in file names. Avoid the following: <, >, ?, *, and ". Also avoid using tabs, spaces, and other non-printable characters.
If you do need to access a file with special characters, enclose the file name in quotation marks.

For example: ls -l "file name with spaces.txt"

If you remove the quotation marks from the above example, you would be asking the system to list four different files.
Also keep in mind that file names are case sensitive. This means that FILE is different from file and File. Once again, although you can create these files, it may be wise to avoid doing so as it may cause confusion in the future.

Absolute and Relative Path Names

The location of a directory or file can be specified by either of two arguments: its absolute path name or its relative path name. An absolute path name has these characteristics:
Begins with a forward slash (/)
Contains the complete name of each directory that must be traversed from the root file system up to the object being named
Can be used anytime, and is valid regardless of the current directory

A relative path name has these characteristics:
Does not begin with a forward slash (/)
Specifies the location of the file or directory relative to the current working directory
Is usually shorter than the respective absolute path name


Home | About | Link | Link
Simple Proff Blogger Template Created By Herro | Inspiring By Busy Bee Woo Themes