UNIX - I file UNIX - Os ficheiros Unix- Die Dateien UNIX - Les fichiers UNIX: Archivos

Introduction to UNIX files

In UNIX systems any element is represented in the form of a file. All files are architectured around a single tree structure where the base, called the root, is written "/".

File types

UNIX systems define different file types:

  • Physical files, entered on the hard disk. This is a file in the generally understood sense of the word;
  • Directories are files (nodes) of the tree structure able to contain files or other directories. A directory contains at least a parent directory (written ..), relating to the directory at the higher level, and a current directory (written .), i.e. itself;
  • Links are special files enabling several names (links) to be associated to a single and same file. This system makes it possible to have several instances of the same file in several places in the tree structure without needing to copy it, which in particular helps to ensure maximum coherence and save on disk space. There are two types of links:
    • Symbolic links representing virtual pointers (shortcuts) to the real files. In the event that a symbolic link is deleted, the file which it points to is not deleted. Symbolic links are created using the In -s command according to the following syntax:
      ln -s name-of-real-file name-of-symbolic-link
    • Physical links (also called hardlinks) represent an alternative name for a file. So, when a file has two physical links, the deletion of one or other of these links does not lead to the deletion of the file. More specifically, while there is at least one physical link remaining, the file is not deleted. On the other hand, when all physical links for the same file are deleted the file is too. Please note however, that it is only possible to create physical links within the single and same file system. Physical links are created using the In (without the option -n) command according to the following syntax:
      ln name-of-real-file name-of-physical-link
  • Virtual files do not really exist because they only exist in the memory. These files, located in particular in the /proc directory contain information about the system (processor, memory, hard disks, processes, etc.);
  • The Device files located in the /dev/ directory relate to the system devices. This concept may be disconcerting for a new user for the first time.

The concept of mount points

Files in a UNIX system are organised into a single tree structure. It is however possible to have several partitions using a mechanism called mounting which makes it possible to connect a partition to a directory in the main tree structure. So, the fact of mounting a partition in the directory /mnt/partition makes all the files in the partition accessible from this directory, called the "mount point".

File hierarchy under Unix

To ensure compatibility and portability, UNIX systems comply with the FHS (File Hierarchy Standard) standard. The basic hierarchy of a Unix system is as follows:

/the root, containing the main directories
/binContains the executables necessary for the system, used by all users.
/bootContains the loading files for the kernel, including the bootstrap loader.
/devContains entry points for the devices.
/etcContains the configuration files required for the administration of the system (files passwd, group, inittab, ld.so.conf, lilo.conf, etc.)
/etc/X11contains specific files for the configuration of X (contains XF86Config, for example)
/homeContains the users' personal directories. Insofar as the directories located under /home are intended to host the user files for the system, you are advised to dedicate a specific partition to the /boot directory in order to limit damage in the case of disk space saturation.
/libContains standard libraries shared between the system's different applications.
/mntMakes it possible to host the mount points of temporary partitions (CD-Rom, floppy disk, etc.)
/procMerges a collection of virtual files making it possible to obtain information about the system or processes being executed.
/rootRoot administrator's personal directory. The administrator's personal directory is located apart from the other personal directories because it is located in the root partition so as to be able to be loaded at the start, before the mounting of the /home partition.
/sbinContains essential system executables (for example the command adduser).
/tmpcontains temporary files
/usrSecondary hierarchy
/usr/X11R6this directory is reserved for system X version 11 release 6
/usr/X386used before by X version 5, this is a symbolic link to /usr/X11R6
/usr/bincontains the majority of binary files and user commands
/usr/includecontains header files for the programs C and C++
/usr/libcontains most of the shared libraries for the system
/usr/localcontains data relating to the programs installed on the local machine by the root
/usr/local/binBinaries for local programs
/usr/local/includeLocal C and C++ header files
/usr/local/libShared local libraries
/usr/local/sbinLocal system binaries
/usr/local/shareIndependent hierarchy
/usr/local/srcLocal source files
/usr/sbincontains binary files not essential for the system that are reserved for the system administrator
/usr/sharereserved for non-dependent data of the architecture
/usr/srccontains source code files
/varcontains changeable data such as database files, logs, files for the print spooler or even waiting emails.


Last update on Thursday October 16, 2008 02:43:15 PM.This document entitled « UNIX - Files » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the licence, as this note appears clearly.
Best answers for « UNIX Files » in :
Converting DOS /UNIX and vice-versa Show Converting DOS /UNIX and vice-versa Intro Conversion DOS to UNIX / UNIX to DOS Conversion from DOS to UNIX Conversion from UNIX to DOS Intro Though there are (dos2unix and unix2dos) utility programs capable of performing this task,...
Download Ext2 Installable File System Show If you currently have Windows running and you realize that you need some files for your work which you have stored on an Ext2 volume of your Linux installation, you no longer have to shut down Windows and boot Linux! Furthermore, Windows will now...
Detect the type of file ShowDetect the type of file Under the system Unix and Linux, the file extension does not have any importance, i.e a file named file.jpg can even be an HTML page like a sound file under format WAV which can be accessed with the existing...
How to read a file line by line ShowHow to read a file line by line Intro Tips Bonus Intro One of the most common errors of learning scripts bash on GNU / Linux is to read a file line by line, is to use a loop "for" (for line in $ (cat file.txt) do. ..), which in this...
Renaming multiple files in batch ShowRenaming multiple files in batch Native features Using a third-party program Renaming a large number of files can quickly become tedious. Fortunately, there are tools to automate this task in many cases: Native features On Windows...
UNIX Commands ShowTable of the main UNIX commands Unix Commands Description Options ls lists the content of a directory -a Displays all files, including hidden files -I Displays a...
FTP protocol (File Transfer Protocol) ShowIntroduction to FTP protocol FTP protocol (File Transfer Protocol) is, as its name indicates a protocol for transferring files. The implementation of FTP dates from 1971 when a file transfer system (described in RFC141) between MIT machines...
Introduction to UNIX systems ShowThe UNIX system The Unix system is a multi-user, multi tasking operating system which means that it allows a single or multiprocessor computer to simultaneously execute several programs by one or several users. It has one or several command...