Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

OpenSuSE 11.1 Quick Start Guide
Previous Page Home Next Page

7.2 The Linux File System

All users including the superuser have their own home directories where all private data, like documents, bookmarks, or e-mail, are stored. System directories holding central configuration files or executable files can only be modified by the superuser. Read more about access permissions and how to modify them according to your needs in Section 8.5, Modifying File Permissions.

In Linux, you can choose whether you want to manage files and folders with a file manager or if you rather like to use the command line which is the traditional way. The last-mentioned method is often faster but requires some deeper knowledge of several commands to list, create, delete, or edit files and their properties. For more information about commands for manipulating files refer to Section 8.3, Working with Files and Directories. A file manager provides a graphical and more intuitive way to handle these tasks. Learn more about the file managers of GNOME and KDE in Section 1.5, Managing Folders and Files with Nautilus, (↑ GNOME User Guide ) and Section 2.2, Using Dolphin File Manager, (↑ KDE User Guide ). Whatever method you choose: The following sections provide you with some basic knowledge of the file system and provide an overview of the default directory structure in Linux.

7.2.1 Key Features

In Linux, all files and directories are located in a tree-like structure. The topmost directory is referred to as the file system root or just / (not to be confused with the root user). The counterpart of / in a Windows system would probably be C:\. All other directories in Linux can be accessed from the root directory and are arranged in a hierarchical structure.

Find the key features of the Linux file system in the following list which also highlights some of the major differences between the Linux and the Windows/DOS file system:

Specifying Paths

As opposed to Windows, Linux does not use backslashes to separate the components of a pathname, it uses slashes instead. For example, the private data of users in Windows may be stored under C:\My Documents\Letters, whereas in Linux it would be stored under /home/username/Letters.

Partitions, Drives/Devices and Directories

Linux does not use drive letters as Windows does. From the mere appearance of a pathname in Linux you can not tell whether you are addressing a partition, a drive/device, a network device or an ordinary directory.

Mounting and Unmounting

Another crucial difference between Windows/DOS and Linux is the concept of mounting and unmounting partitions, drives or directories. Windows detects partitions and drives during the boot process and assigns a drive letter to them. In Linux however, partitions or devices are usually not visible in the directory tree unless they are mounted, that means integrated into the file system at a specific location in the directory tree. As a normal user you cannot access data on a partition or a device unless it is mounted. But don't worry— most of the times you do not have to mount partitions or devices manually. During the installation of your system, you can define partitions to be mounted automatically when the system is started. Removable devices are usually also detected and mounted automatically by your system—the desktop environments such as KDE or GNOME will inform you about the appearance of a new device.

Figure 7-2 Autodetection of a USB Stick in KDE

Although this concept of mounting and unmounting may appear complicated or cumbersome at first sight this also offers great flexibility: for example you can easily mount a directory from a another machine over the network and act on that directory as though it were located on your local machine.

Case-Sensitivity

Linux distinguishes between uppercase and lowercase letters in the file system. For example, whether you name a file test.txt, TeST.txt or Test.txt make a difference in Linux. This also holds true for directories: You cannot access a directory named Letters by the name letters.

File Extensions

As opposed to Windows, files in Linux may have a file extension, such as .txt, but do not need to have one. When you start working with the shell this sometimes makes it difficult for beginners to differentiate between files and folders, depending on the command you use to list the contents of a directory. Learn more about some basic shell commands in Section 8.0, Shell Basics. If you use the graphical file managers in GNOME or KDE (see Section 1.5, Managing Folders and Files with Nautilus, (↑ GNOME User Guide ) and Section 2.2, Using Dolphin File Manager, (↑ KDE User Guide )) files and folders are symbolized by various different icons depending on the view you choose.

Figure 7-3 File and Folders in KDE File Manager

Hidden Files

Similar to Windows, Linux also distinguishes between normal files and hidden files which are often configuration files that you usually do not want to access or see as a normal user. In Linux, hidden files are indicated by a dot in front (for example, .hiddenfile). In order to access hidden files you can switch view in the file managers as described in Section 2.2, Using Dolphin File Manager, (↑ KDE User Guide ) or use a certain command in the shell as described in Section 8.2.2, Using Commands with Options.

File System Permissions

Because Linux is a multiuser system, every file in a Linux file system belongs to a user and a group. Only the owner of a file or directory (or, of course, root) can grant other users access permission to it. Linux basically distinguishes between three different types of access permissions: write permission, read permission and execute permission. You can only access a file or a folder if you have at least read permission to it. There are several ways to change the access permissions of files and folders: either traditionally via the shell or with the help of your desktop's file manager (see Section 2.2, Using Dolphin File Manager, (↑ KDE User Guide )). If you have root privileges, you can also change the owner and the group of a file or folder. Read how to do so in a shell in Section 8.5, Modifying File Permissions.

For more detailed information about file system permissions refer to Section 7.3, File Access Permissions. Apart from the traditional permission concept for file system objects there are also extensions available which handle permissions more flexibly. Read more in Section 18.0, Access Control Lists in Linux, (↑ Reference ).

7.2.2 The Directory Structure

The following table provides a short overview of the most important higher-level directories you find on a Linux system. Find more detailed information about the directories and important subdirectories in the following list.

Table 7-1 Overview of a Standard Directory Tree

Directory

Contents

/

Root directory—the starting point of the directory tree.

/bin

Essential binary files, such as commands that are needed by both the system administrator and normal users. Usually also contains the shells, such as Bash.

/boot

Static files of the boot loader.

/dev

Files needed to access host-specific devices.

/etc

Host-specific system configuration files.

/home

Holds the home directories of all users who have an account on the system. Only root's home directory is not located in /home but in /root.

/lib

Essential shared libraries and kernel modules.

/media

Mount points for removable media.

/mnt

Mount point for temporarily mounting a file system.

/opt

Add-on application software packages.

/root

Home directory for the superuser root.

/sbin

Essential system binaries.

/srv

Data for services provided by the system.

/tmp

Temporary files.

/usr

Secondary hierarchy with read-only data.

/var

Variable data such as log files.

/windows

Only available if you have both Microsoft Windows* and Linux installed on your system. Contains the Windows data.

The following list provides more detailed information and gives some examples which files and subdirectories can be found in the directories:

/bin

Contains the basic shell commands that may be used both by root and by other users. These commands include ls, mkdir, cp, mv, rm, and rmdir. /bin also contains Bash, the default shell in openSUSE.

/boot

Contains data required for booting, such as the boot loader, the kernel, and other data that is used before the kernel begins executing user mode programs.

/dev

Holds device files that represent hardware components.

/etc

Contains local configuration files that control the operation of programs like the X Window System. The /etc/init.d subdirectory contains scripts that are executed during the boot process.

/home/username

Holds the private data of every user who has an account on the system. The files located here can only be modified by their owner or by the system administrator. By default, your e-mail directory and personal desktop configuration are located here in form of hidden files and directories. KDE users find the personal configuration data for their desktop in .kde or .kde4 respectively, GNOME users find it in .gconf. For information about hidden files, refer to Section 7.2.1, Key Features.

NOTE: Home Directory in a Network Environment

If you are working in a network environment, your home directory may be mapped to a directory in the file system other than /home.

/lib

Contains essential shared libraries needed to boot the system and to run the commands in the root file system. The Windows equivalent for shared libraries are DLL files.

/media

Contains mount points for removable media, such as CD-ROMs, USB sticks, and digital cameras (if they use USB). /media generally holds any type of drive except the hard drive of your system. As soon as your removable medium has been inserted or connected to the system and has been mounted, you can access it from here.

/mnt

This directory provides a mount point for a temporarily mounted file system. root may mount file systems here.

/opt

Reserved for the installation of additional software. Optional software and larger add-on program packages can be found there. KDE3 is located there, whereas KDE4 and GNOME have moved to /usr now.

/root

Home directory for the root user. Personal data of root is located here.

/sbin

As the s indicates, this directory holds utilities for the superuser. /sbin contains binaries essential for booting, restoring, and recovering the system in addition to the binaries in /bin.

/srv

Holds data for services provided by the system, such as FTP and HTTP.

/tmp

This directory is used by programs that require temporary storage of files.

/usr

/usr has nothing to do with users, but is the acronym for UNIX system resources. The data in /usr is static, read-only data that can be shared among various hosts compliant to the Filesystem Hierarchy Standard (FHS). This directory contains all application programs and establishes a secondary hierarchy in the file system. KDE4 and GNOME are also located here. /usr holds a number of subdirectories, such as /usr/bin, /usr/sbin, /usr/local, and /usr/share/doc.

/usr/bin

Contains generally accessible programs.

/usr/sbin

Contains programs reserved for the system administrator, such as repair functions.

/usr/local

In this directory, the system administrator can install local, distribution-independent extensions.

/usr/share/doc

Holds various documentation files and the release notes for your system. In the manual subdirectory, find an online version of this manual. If more than one language is installed, this directory may contain versions of the manuals for different languages.

Under packages, find the documentation included in the software packages installed on your system. For every package, a subdirectory /usr/share/doc/packages/packagename is created that often holds README files for the package and sometimes examples, configuration files, or additional scripts.

If HOWTOs are installed on your system /usr/share/doc also holds the howto subdirectory in which to find additional documentation on many tasks relating to the setup and operation of Linux software.

/var

Whereas /usr holds static, read-only data, /var is for data which is written during system operation and thus is variable data, such as log files or spooling data. For example, the log files of your system are in /var/log/messages (only accessible for root).

/windows

Only available if you have both Microsoft Windows and Linux installed on your system. Contains the Windows data available on the Windows partition of your system. Whether you can edit the data in this directory depends on the file system your Windows partition uses. If it is FAT32, you can open and edit the files in this directory. For an NTFS file system, however, you can only read your Windows files from Linux, but not modify them. Learn more in Section 11.3, Accessing Files on Different OS on the Same Computer.

OpenSuSE 11.1 Quick Start Guide
Previous Page Home Next Page

 
 
  Published under the terms fo the GNU General Public License Design by Interspire