4. Linux Filesystem Management
The Filesystem Hierarchy Standard
The files on a typical Linux system are organized into directories in the linux tree.
To simplify the task of finding specific files, the Filesystem Hierarchy Standard (FHS) was
created.
FHS defines a standard set of directories for use by all Linux and UNIX systems as well as the file
and subdirectory contents of each directory.
Directory Description
/bin Binary commands for use by all users
/boot Contains Linux kernel and files used by the boot
loader
/dev Contains device files
/etc Contains system-specific configuration files
/home Default location for user home directories
/lib Contains shared program libraries as well as
kernel modules
/media Contains subdirectories used for accessing
(mounting) fylesistems on removable media
deivces
/mnt Empty directory used for temporarily accessing
filesystems on removable media devices
/opt Stores additional software programs
/proc Contains process and kernel information
/root Root user’s home directory
/sbin Contains binary commands (for administration)
/sys Contains configuration information for hardware
devices on the system
, /tmp Holds temporary files created by programs
/usr Contains most system commands and utilities
/usr/bin – User binary commands
/usr/games – Educational programs and games
/usr/include – C program header files
/usr/lib – Libraries/usr/local–Local programs
/usr/sbin – System binary commands
/usr/share – Files that are architecture
independent
/usr/src – Source Code
/usr/X11R6 – The X Window system (sometimes
replaced by /etc/X11)
/usr/local Location for most additional programs
/var Contains log files and spools
Managing Files and Directories
To create a directory use the mkdir (make directory) command.
o Takes an argument specifying the absolute or relative pathnames of the directories to
create.
To move files, use the mv (move) command.
o Requires to arguments as minimum: the source file/directory and the target
file/directory.
o You can also use mv to rename files.
To copy files, use cp (copy) command.
o Requires two arguments as minimum (like the mv command)
o Use the -r option to copy a directory full of files
The copy will be recursive
mv and cp actually run with the -i option.
o If you want to override this opetion, use the -f (force) option
The Filesystem Hierarchy Standard
The files on a typical Linux system are organized into directories in the linux tree.
To simplify the task of finding specific files, the Filesystem Hierarchy Standard (FHS) was
created.
FHS defines a standard set of directories for use by all Linux and UNIX systems as well as the file
and subdirectory contents of each directory.
Directory Description
/bin Binary commands for use by all users
/boot Contains Linux kernel and files used by the boot
loader
/dev Contains device files
/etc Contains system-specific configuration files
/home Default location for user home directories
/lib Contains shared program libraries as well as
kernel modules
/media Contains subdirectories used for accessing
(mounting) fylesistems on removable media
deivces
/mnt Empty directory used for temporarily accessing
filesystems on removable media devices
/opt Stores additional software programs
/proc Contains process and kernel information
/root Root user’s home directory
/sbin Contains binary commands (for administration)
/sys Contains configuration information for hardware
devices on the system
, /tmp Holds temporary files created by programs
/usr Contains most system commands and utilities
/usr/bin – User binary commands
/usr/games – Educational programs and games
/usr/include – C program header files
/usr/lib – Libraries/usr/local–Local programs
/usr/sbin – System binary commands
/usr/share – Files that are architecture
independent
/usr/src – Source Code
/usr/X11R6 – The X Window system (sometimes
replaced by /etc/X11)
/usr/local Location for most additional programs
/var Contains log files and spools
Managing Files and Directories
To create a directory use the mkdir (make directory) command.
o Takes an argument specifying the absolute or relative pathnames of the directories to
create.
To move files, use the mv (move) command.
o Requires to arguments as minimum: the source file/directory and the target
file/directory.
o You can also use mv to rename files.
To copy files, use cp (copy) command.
o Requires two arguments as minimum (like the mv command)
o Use the -r option to copy a directory full of files
The copy will be recursive
mv and cp actually run with the -i option.
o If you want to override this opetion, use the -f (force) option