10.1 File Management in Linux


Linux is the operating system (OS: Operating System) which allows users to manage files directly. Managing files requires the knowledge of hard disk, file system and directory structure.

If you want to use hard disk in Linux, you have to prepare by some commands, so you should know the file system. You have to choose a file system according to the purpose, and prepare the file system by commands.

Let's learn about directory, for example standard directory structure, and its status check commands.

10.1.1 File System

The file system is the mechanism for managing files efficiently. There are some kinds of file system formats which manage file attributes, such as file name, saved date and so on, and file data efficiently. The efficiency and the safety for accessing files, depend on the file system. If you understand the general concept of file system, you can understand the commands already explained, more clearly.

10.1.2 Partition

In order to use, a hard disk is divided into some units which are called partition. Before using a disk, we have to divide the disk into some partitions at the beginning. This disk dividing is called 'partitioning'.

10.1.3 Directory Structure of Linux

If you manage data by files, the number of files will be increasing, and which make it difficult to find the file you want to access. In order to manage those files efficiently, EXT3 file system provides directory like other many file systems do. The directory can manage files collectively, and other directories can be also handled like same. By using directory, you can classify files into directories by purpose. You can also manage more files systematically by hierarchy. The directory structure of UNIX systems including Linux is a tree structure from which the / directory is origin.


'/ directory' is called 'root directory', and is the origin of the tree structure. All of files and directories exist under '/ directory',.


In order to use disk (hard disk, DVD-ROM drives, memory space, etc.), you should mount its first one to the / directory.

When using two or more disks, you should mount the second or its later disk, to the directory in the already mounted disk. (If a disk is mounted to the directory which already has contents, the contents will be replaced by new contents. It happens even if it is / directory, and it means old contents can not be accessed.)



Column: FHS(Filesystem Hierarchy Standard)



Since a file always exists in a directory, a description which begins from the / directory can be done. In Linux system, the composition of the directory is defined based on the standard called FHS. There are general executable programs for user in bin directory. The system management programs are in sbin, and configuration files are in /etc. The common libraries which are used by other multiple programs, are in lib directory. The log files are placed under var directory.

There is a same directory structure under /usr directory. The original files of its user are sometimes placed in /usr/local directory.

There are boot related files in /boot, and there are device related files in /dev. There is /home directory for user's work space. The temporary files are placed in /tmp directory temporarily.
Figure10-1
Figure 10-1: FHS structure and files placed in each directories

boot --- The configuration files and programs which are required for starting
bin --- The programs for general users
sbin --- The programs for system managements
lib --- The library programs(library) used in common by two or more programs
var --- variable files like log, mail, a homepage, etc.
etc --- Configuration files
home --- The home directories which are user's workspaces
dev --- Device files
proc --- The virtual file system for referring to kernel and processes
mnt --- Temporary mount pointer (directory) of a file system≒/media
tmp --- Temporary files


10.1.4 How to create File System

We can use new hard disk by following procedures.


The command which comes out henceforth is a command for system managements in a /sbin directory. Many system management commands should be run by the root user (after becoming an administrator). Since there is no authority of system management, the general users cannot execute the command for system managements, or even if they can execute the command for system management, they cannot access required resources (hard disk etc.). Moreover, by initial setting, general users do not have command path to /sbin of commands for system management, they have to use absolute path(description from the / directory) like /sbin/fdisk.

Please reconfirm that when prompt is '#', the command requires root user. If you are a general user, please execute the command after becoming the root user by using "su [ - ]" command.

The detailed explanation of the commands will be done later.


Column: Terminological differences from Windows



The difference in the term regarding this task in Linux and Windows is as follows.

Create file systems (Linux) <=> Format (Windows)




Previous Next