The UNIX File System. File System Definition A file system is a hierarchy of directories,...
-
date post
21-Dec-2015 -
Category
Documents
-
view
223 -
download
0
Transcript of The UNIX File System. File System Definition A file system is a hierarchy of directories,...
![Page 1: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/1.jpg)
The UNIX File System
![Page 2: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/2.jpg)
File System Definition
• A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information on hard disks.
![Page 3: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/3.jpg)
Directories
• Directories 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.
![Page 4: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/4.jpg)
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
![Page 5: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/5.jpg)
Directories
• The 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).
![Page 6: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/6.jpg)
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
![Page 7: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/7.jpg)
Path Components
• Directory 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 files• DOS 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.
![Page 8: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/8.jpg)
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 files
Continued…
![Page 9: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/9.jpg)
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 system
Continued…
![Page 10: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/10.jpg)
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 e-mail
![Page 11: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/11.jpg)
Absolute Path Names
• An absolute path name specifies a file or directory in relation to the entire UNIX file hierarchy.
directorys
![Page 12: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/12.jpg)
Relative Path Names
• A relative path name describes the location of a file or directory as it relates to the current directory.
directory
![Page 13: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/13.jpg)
Path Name Types Comparison
• If the path name starts with /:– It is an absolute path name.
• Ex: /etc/resolv.conf
• If the path does not start with /:– It is a relative path name.
• Ex: user01/file1
• Absolute path names specify the exact location of a file or directory.– In Windows: C:\Windows\System32\file.dll
• Relative 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
![Page 14: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/14.jpg)
Useful File System Commands
• pwd (print working directory)– Displays current directory location
• cd (change directory)– Change to a specified directory
• ls (list)– Display contents of directory
![Page 15: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/15.jpg)
Using cd
• cd /home– Absolute Path
• In /home, cd user01/dir1– Relative Path
• cd (by itself) places user in home directory
![Page 16: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/16.jpg)
cd Shortcuts
• cd ..– Moves the user up one directory to the parent
directory– cd ..– cd ../tmp
• cd .– Keeps the user in the current directory– cd ./coffees
• cd ~– Moves the user to the home directory– cd ~– cd ~/file1
![Page 17: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/17.jpg)
The ls Command
• ls 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.– ls– ls /home
![Page 18: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/18.jpg)
The ls –a Command
• Use ls –a to list all files and directories, including hidden files, . and .. directories.
![Page 19: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/19.jpg)
The ls –l Command
• Use ls –l to display long directory listings.
![Page 20: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/20.jpg)
Metacharacters
• Metacharacter are characters that have special meanings to UNIX and Linux commands.
• Examples:*, <, >, | (pipe), !, [, ], ? and others
• The * and ? are also referred to as wildcard characters.
![Page 21: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/21.jpg)
The * Wildcard
* is used to represent one or more characters
![Page 22: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/22.jpg)
The ? Wildcard
? is used to represent one character
![Page 23: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/23.jpg)
The [ ] Metacharacters
Using [ ], anything inside the brackets will be matched
![Page 24: The UNIX File System. File System Definition A file system is a hierarchy of directories, subdirectories, and files that organize and manage the information.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d635503460f94a46154/html5/thumbnails/24.jpg)
The ; Metacharacter
; is used to separate multiple commands on one line