Download presentation
Presentation is loading. Please wait.
Published byCecily Pearson Modified over 9 years ago
2
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem
3
2 © 2001 John Urrutia. All rights reserved. Topics The Hierarchical File System Directory and Ordinary Files Working With Directories Access Permissions Links
4
3 © 2001 John Urrutia. All rights reserved. Hierarchical File Systems Structured like an upside-down tree Grandparents at the top Parents follow Then Children Topics
5
4 © 2001 John Urrutia. All rights reserved. Child 1Child 2Child 3 Grandparent Parentauntuncle/Alice/Bobby/Carol/home/tmp/bin Hierarchical Structure / (aka root)
6
5 © 2001 John Urrutia. All rights reserved. Hierarchical File Systems Directories and ordinary files Directories / sub-directories Special files used for grouping Ordinary Files Contain the kitchen sink
7
6 © 2001 John Urrutia. All rights reserved. Directory assistance Directories provide an organized method to access ordinary files. path – A series of directory files traveling from the root to the ordinary file. pathname – The sequenced listing of directory names from the root to the ordinary file.
8
7 © 2001 John Urrutia. All rights reserved. Filenames Max length 255 characters A thru Z, a thru z, 0 thru 9 _., Some file systems limit these to 14 characters Make them meaningful 30952344 IMd12CRU OOicu812
9
8 © 2001 John Urrutia. All rights reserved. Filename Extensions Begins with a period Generally are optional Used by applications to identify specific file needed by the application Examples: CPP TXT INI
10
9 © 2001 John Urrutia. All rights reserved. Invisible Files Must start with a period Normally not displayed Used by Unix for special purposes Use “ ls –a ” to see these
11
10 © 2001 John Urrutia. All rights reserved. Topics The Hierarchical File System Directory and Ordinary Files Working With Directories Access Permissions Links
12
11 © 2001 John Urrutia. All rights reserved. Creating a directory mkdir – utility creates a directory The argument can either specify an absolute pathname or a relative pathname mkdir mydirectory In this example “mydirectory” will be created under the current or working directory
13
12 © 2001 John Urrutia. All rights reserved. Directory file Two invisible files are created for each directory created One is the pathname of the working directory named “ ” Two is the pathname of the parent directory named “ ” cat./Test.file cat Test.file
14
13 © 2001 John Urrutia. All rights reserved. Path (to glory or destruction) Every file has a PATHNAME Absolute Pathnames begin with the root (/) Each directory in the hierarchy from the root to the file is separated by a slash
15
14 © 2001 John Urrutia. All rights reserved. Test.file Path example: /Alice/Bobby/Carol /home/tmp/bin // /home /Bobby Test.file /home/Bobby/Test.file
16
15 © 2001 John Urrutia. All rights reserved. Absolute & Relative Path Absolute path is fully qualified cat /home/Bobby/Test.file Relative path is based on the working directory pwd – Print Working Directory /home/Bobby cat Test.file
17
16 © 2001 John Urrutia. All rights reserved. The Working Directory You’re working directory is assigned by the login process. To access files in working directory simply refer to the filename no path is needed. Files outside your working directory require a pathname.
18
17 © 2001 John Urrutia. All rights reserved. Your Working Directory Generally you’re working directory will be /home/userid
19
18 © 2001 John Urrutia. All rights reserved. Important Directories and Files The root - / (of all evil) /root – Home directory for root /boot – static files of the boot loader /bin – files needed to boot the system /sbin – /usr/sbin system admin. utilities /dev – device files /etc – admin. and configuration files
20
19 © 2001 John Urrutia. All rights reserved. Important Directories and Files /tmp– temporary files /home – user home directories /lib – shared libraries /mnt – mount point of temporary partitions /tmp – temporary files /usr – 2 nd major hierarchy – rarely change /proc – kernel and process information
21
20 © 2001 John Urrutia. All rights reserved. Changing working directory pwd – displays your working directory cd - change directory By default places you in your working directory (ie /home/userid) cd ~ (will do the same thing) cd path/path1 – changes relative to your working directory
22
21 © 2001 John Urrutia. All rights reserved. Access Permissions Every file has access “permissions” associated with them. r – read w – write x – execute
23
22 © 2001 John Urrutia. All rights reserved. Access Permissions Every ordinary file has three access groups. Owner or User User who created the file Group Users who are associated Others The rest of the world
24
23 © 2001 John Urrutia. All rights reserved. Access Permissions Directory file access “permissions” r – read the directory w – write the directory x – search the directory
25
24 © 2001 John Urrutia. All rights reserved. Access Permissions Setting default “permissions” umask 000 One digit each for U,G,O Octal value representing the 3 bits RWXRWXRWX 421421421
26
25 © 2001 John Urrutia. All rights reserved. Directory Utilities chmod – change access mode u – User or owner g – group o – others + – add permission - – remove permission
27
26 © 2001 John Urrutia. All rights reserved. Directory Utilities mkdir – Make Directory mkdir –p directory-list The –p option creates the parent directory if it doesn’t exist directory-list One or more directories separated by space
28
27 © 2001 John Urrutia. All rights reserved. Directory Utilities rmdir – remove Directory rmdir directory-list directory-list One or more directories separated by space
29
28 © 2001 John Urrutia. All rights reserved. Directory Utilities rm – remove rm –r directory-list The –r option removes recursively. All subdirectories are removed directory-list One or more directories separated by space
30
29 © 2001 John Urrutia. All rights reserved. Directory Utilities cd – change directory cd directory The directory (pathname) becomes the working directory
31
30 © 2001 John Urrutia. All rights reserved. Links aka – Also Known As Creates an entry in the directory that point to an existing file or directory. Doesn’t create a copy of the file
32
31 © 2001 John Urrutia. All rights reserved. Links – Hard and Symbolic Hard links Behave just like a file Cannot distinguish the original filename from the link Cannot cross file systems Directory links by superuser only
33
32 © 2001 John Urrutia. All rights reserved. Links – Hard and Symbolic Symbolic links Indirect pointer to file or directory Can be created by anyone Can reside anywhere Can become an orphan
34
33 © 2001 John Urrutia. All rights reserved. Link Utility ln – Make a link entry ln [–s] filename linkname ln [–s] file-list directory
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.