Dec 13, 2009

Working with the Linux File System

The Linux file system is the structure in which all the information on your computer is stored.Files are organized within a hierarchy of directories. Each directory can contain files, as well as other directories.

If you were to map out the files and directories in Linux, it would look like an upside-down tree. At the top is the root directory, which is represented by a single slash (/). Below that is a set of common directories in the Linux system, such as bin, dev, home, lib, and tmp, to name a few. Each of those directories, as well as directories added to the root, can contain subdirectories. Figure illustrates how the Linux file system is organized as a hierarchy. To demonstrate how directories are connected, the figure shows a /home directory that contains subdirectories for three users: chris, mary, and tom. Within the chris directory are subdirectories: briefs, memos, and personal. To refer to a file called inventory in the chris/memos directory, you can type the full path of /home/chris/memos/inventory. If your current directory is /home/chris/memos, you can refer to the file as simply inventory.
Some of the Linux directories that may interest you include the following:
* /bin — Contains common Linux user commands, such as ls, sort, date, and chmod.
* /boot — Has the bootable Linux kernel and boot loader configuration files (GRUB).
* /dev — Contains files representing access points to devices on your systems. These include terminal devices (tty*), floppy disks (fd*), hard disks (hd*), RAM (ram*), and CD-ROM (cd*). (Users normally access these devices directly through the device files.)
* /etc — Contains administrative configuration files.
* /home — Contains directories assigned to each user with a login account.
* /media — Provides a standard location for mounting and automounting devices, such as remote file systems and removable media (with directory names of cdrecorder, floppy, and so on).
* /mnt — A common mount point for many devices before it was supplanted by the standard /media directory. Some bootable Linux systems still used this directory to mount hard disk partitions and remote file systems.
* /proc — Contains information about system resources.
* /root — Represents the root user’s home directory.
* /sbin — Contains administrative commands and daemon processes.
* /sys (A /proc-like file system, new in the Linux 2.6 kernel and intended to contain files for getting hardware status and reflecting the system’s device tree as it is seen by the kernel. It pulls many of its functions from /proc.
* /tmp — Contains temporary files used by applications.
* /usr — Contains user documentation, games, graphical files (X11), libraries (lib), and a variety of other user and administrative commands and files.
* /var — Contains directories of data used by various applications. In particular, this is where you would place files that you share as an FTP server (/var/ftp) or a Web server (/var/www). It also contains all system log files (/var/log) and spool files in /var/spool (such as mail, cups, and news). The file systems in the DOS or Microsoft Windows operating systems differ from Linux’s file structure, as the “Linux File Systems Versus Windows-Based File Systems” explains.


Reference: Negus, Linux Bible 2007

No comments:

Post a Comment

Visual Studio Keyboard Shortcuts

Playing with keyboard shortcuts is very interesting and reduce the headache of using the mouse again and again while programming with visu...