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 7.5, “Modifying File Permissions”.
In Linux, you can choose whether you want to manage files and folders with a file manager or with the command line, which is the traditional way. The latter 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 7.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 “Managing Folders and Files with Nautilus” (Chapter 2, Working with Your Desktop, ↑GNOME User Guide) and Section “Using Dolphin File Manager” (Chapter 2, Working with Your Desktop, ↑KDE User Guide). The following sections provide you with some basic knowledge of the file system and provide an overview of the default directory structure in Linux.
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:
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
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.
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 time 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.
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.
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.
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
Chapter 7, Shell Basics. If you use the graphical file managers
in GNOME or KDE (see Section “Managing Folders and Files with Nautilus” (Chapter 2, Working with Your Desktop, ↑GNOME User Guide)
and Section “Using Dolphin File Manager” (Chapter 2, Working with Your Desktop, ↑KDE User Guide)) files and folders are
symbolized by various different icons depending on the view you
choose.
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 “Using Dolphin File Manager” (Chapter 2, Working with Your Desktop, ↑KDE User Guide) or use a certain command in the
shell as described in Section 7.2.2, “Using Commands with Options”.
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.
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 7.5, “Modifying File Permissions”.
For more detailed information about file system permissions refer to Section 6.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 Chapter Access Control Lists in Linux (↑Security Guide).
The following table provides a short overview of the most important higher-level directories that you find on a Linux system. Find more detailed information about the directories and important subdirectories in the following list.
Table 6.1. Overview of a Standard Directory Tree
|
Directory |
Contents |
|---|---|
|
Root directory—the starting point of the directory tree. | |
|
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. | |
|
Static files of the boot loader. | |
|
Files needed to access host-specific devices. | |
|
Host-specific system configuration files. | |
|
Holds the home directories of all users who have accounts on the
system. However, | |
|
Essential shared libraries and kernel modules. | |
|
Mount points for removable media. | |
|
Mount point for temporarily mounting a file system. | |
|
Add-on application software packages. | |
|
Home directory for the superuser | |
|
Essential system binaries. | |
|
Data for services provided by the system. | |
|
Temporary files. | |
|
Secondary hierarchy with read-only data. | |
|
Variable data such as log files. | |
|
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 of 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 the form of hidden files and
directories. KDE users find the personal configuration data for their
desktop in .kde or .kde4 .
GNOME users find it in .gconf.
For information about hidden files, refer to
Section 6.2.1, “Key Features”.
![]() | 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
| |
/lib
Contains the 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 here. KDE3 is located
here, whereas KDE4 and GNOME have moved to /usr
now.
/root
Home directory for the root user. The personal data of root
is located here.
/sbin
As the s indicates, this directory holds utilities
for the superuser. /sbin contains the 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 the 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 with 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/
is created that often holds README files for the package and sometimes
examples, configuration files or additional scripts.
packagename
If HOWTOs are installed on your system
/usr/share/doc also holds the
howto subdirectory in which to find additional
documentation on many tasks related 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 an overview of the most important log files you can find
under /var/log/, refer to
Table 9.1, “Log Files”.
/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 NTFS, openSUSE also includes write access support. However, the driver for the NTFS-3g file system has limited functionality. Learn more in Section “Accessing Files on Different OS on the Same Computer” (Chapter 34, Copying and Sharing Files, ↑Reference).