2 File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information on hard disks.
3 DirectoriesDirectories are created so users and applications can easily find files.Without directories, all files would be in the same location with no organization to them.Similar to using the backseat of your car to hold homework assignments and papers.
4 Hierarchical Directory Structure Directories are organized in an ‘upside-down’ tree fashion.The root is at the top.Directories may contain other directories and files.Analogous to file drawers and file folders
5 DirectoriesThe root directory is often represented as / (the forward slash symbol).Parent directories contain other directories (called children).Child directories are located within other directories (called parent directories).
6 Path Names Each file can be represented by its path name. The path name simply represents the file’s location in the file system.Example: /home/user2/dir1/coffees/beans
7 Path ComponentsDirectory paths allow users to navigate within the file system.Slashes within the path name are delimiters between object names.Object names can be directories, subdirectories or filesDOS and Windows uses a backward slash (\) to separate directories. UNIX and Linux use a forward slash (/).A slash (/) in the first position of any path name represents the root directory.
8 Exploring the Root File System The root directory contains sub-directories that contain files:/bin contains binaries, or executables needed to start the system and perform system tasks available to all users/boot contains files needed by the bootstrap loader as well as kernel images/dev contains system device reference filesContinued…
9 Exploring the Root File System Root subdirectories continued:/etc contains configuration files that the system uses when the computer starts/lib contains kernel modules, security information, and the shared library images/mnt contains mount points for temporary mounts by the system administrator/proc is a virtual file system allocated in memory only; it tracks the running processes on the systemContinued…
10 Exploring the Root File System Root subdirectories continued:/root is the home directory of the root user, or the system administrator/sbin contains essential network programs used only by the system administrator/tmp is a temporary place to store data during processing cycles/var contains subdirectories which have sizes that often change, such as error logs, print jobs, and incoming
11 Absolute Path NamesAn absolute path name specifies a file or directory in relation to the entire UNIX file hierarchy.directorys
12 Relative Path NamesA relative path name describes the location of a file or directory as it relates to the current directory.directory
13 Path Name Types Comparison If the path name starts with /:It is an absolute path name.Ex: /etc/resolv.confIf the path does not start with /:It is a relative path name.Ex: user01/file1Absolute path names specify the exact location of a file or directory.In Windows: C:\Windows\System32\file.dllRelative path names specify where a file or directory is in relation to the current spot in the file system.In the Windows folder: System32\file.dll
14 Useful File System Commands pwd (print working directory)Displays current directory locationcd (change directory)Change to a specified directoryls (list)Display contents of directory
15 cd (by itself) places user in home directory Using cdcd /homeAbsolute PathIn /home, cd user01/dir1Relative Pathcd (by itself) places user in home directory
16 cd Shortcutscd ..Moves the user up one directory to the parent directorycd ../tmpcd .Keeps the user in the current directorycd ./coffeescd ~Moves the user to the home directorycd ~/file1
17 ls displays the directory contents. The ls Commandls displays the directory contents.ls can be used by itself to list the contents of the current directory.ls can be used with a directory path to display the contents of that directory.lsls /home
18 The ls –a CommandUse ls –a to list all files and directories, including hidden files, . and .. directories.
19 The ls –l CommandUse ls –l to display long directory listings.
20 The * and ? are also referred to as wildcard characters. MetacharactersMetacharacter are characters that have special meanings to UNIX and Linux commands.Examples:*, <, >, | (pipe), !, [, ], ? and othersThe * and ? are also referred to as wildcard characters.
21 The * Wildcard* is used to represent one or more characters
22 The ? Wildcard? is used to represent one character
23 The [ ] MetacharactersUsing [ ], anything inside the brackets will be matched
24 The ; Metacharacter; is used to separate multiple commands on one line