File System and Directory Structure in Linux. What is File System In a computer, a file system is...
-
Upload
brandon-dean -
Category
Documents
-
view
217 -
download
0
Transcript of File System and Directory Structure in Linux. What is File System In a computer, a file system is...
![Page 1: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/1.jpg)
File System and Directory Structure in Linux
![Page 2: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/2.jpg)
What is File System
• In a computer, a file system is the way in which files are named and where they are placed logically for storage and retrieval.
• Sometimes the term refers to the part of an operating system or an added-on program that supports a file system. Examples of such add-on file systems include the Network File System (NFS).
![Page 3: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/3.jpg)
logical file structure
physical representation on disk
![Page 4: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/4.jpg)
File System
• File systems specify conventions for naming files. These conventions include the maximum number of characters in a name, which characters can be used, and, in some systems, how long the file name suffix can be. A file system also includes a format for specifying the path to a file through the structure of directories.
![Page 5: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/5.jpg)
Linux File System
• Ext2: This is like UNIX file system. • Ext3: It is ext2 filesystem with enhancement.• Isofs (iso9660): Used by CDROM file system.• Sysfs: It is a ram-based filesystem initially based
on ramfs. It is use to exporting kernel objects so that end user can use it easily.
• Procfs: The proc file system acts as an interface to internal data structures in the kernel For example you can find out cpuinfo with following command:
![Page 6: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/6.jpg)
Inside File System
• User Data• Meta Data
![Page 7: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/7.jpg)
Linux Directory Structure
• The Directory Structure in Unix & Linux are a unified Directory Structure where in all the directories are unified under the "/" Root file system. Irrespective of where the File System is physically mounted all the directories are arranged hierarchically under the Root file system.
![Page 8: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/8.jpg)
![Page 9: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/9.jpg)
1. / – Root
• Every single file and directory starts from the root directory.
• Only root user has write privilege under this directory.
![Page 10: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/10.jpg)
2. /bin – User Binaries
• Contains binary executables.• Common linux commands you need to use in
single-user modes are located under this directory.
• For example: ps, ls, ping, grep, cp.
![Page 11: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/11.jpg)
3. /sbin – System Binaries
• Just like /bin, /sbin also contains binary executables.
• But, the linux commands located under this directory are used typically by system administrator, for system maintenance purpose.
• For example: iptables, reboot, fdisk, ifconfig,
![Page 12: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/12.jpg)
4. /etc – Configuration Files
• Contains configuration files required by all programs.
• This also contains startup and shutdown shell scripts used to start/stop individual programs.
• For example: /etc/resolv.conf, /etc/logrotate.conf
![Page 13: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/13.jpg)
5. /dev – Device Files
• Contains device files.• These include terminal devices, usb, or any
device attached to the system.• For example: /dev/tty1, /dev/usbmon0
![Page 14: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/14.jpg)
6. /proc – Process Information
• Contains information about system process.• This filesystem contains information about
running process. For example: /proc/{pid} directory contains information about the process with that particular pid.
• This is a virtual filesystem with text information about system resources. For example: /proc/uptime
![Page 15: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/15.jpg)
7. /var – Variable Files
• var stands for variable files.• Content of the files that are expected to grow
can be found under this directory.• This includes — system log files (/var/log);
packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp);
![Page 16: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/16.jpg)
8. /tmp – Temporary Files
• Directory that contains temporary files created by system and users.
• Files under this directory are deleted when system is rebooted.
![Page 17: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/17.jpg)
9. /usr – User Programs
• Home directories for all users to store their personal files.
• For example: /home/john
![Page 18: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/18.jpg)
11. /boot – Boot Loader Files
• Contains boot loader related files.• Grub files are located under /boot• For example: initrd.img-2.6.32-24-generic,
vmlinuz-2.6.32-24-generic
![Page 19: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/19.jpg)
12. /lib – System Libraries
• Contains library files that supports the binaries located under /bin and /sbin
• Library filenames are either ld* or lib*.so.*• For example: ld-2.11.1.so, libncurses.so.5.7
![Page 20: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/20.jpg)
13. /opt – Optional add-on Applications
• opt stands for optional.• Contains add-on applications from individual
vendors.• add-on applications should be installed under
either /opt/ or /opt/ sub-directory.
![Page 21: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/21.jpg)
14. /mnt – Mount Directory
• Temporary mount directory where sysadmins can mount filesystems.
![Page 22: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/22.jpg)
Inode
• The inode (index node) is a fundamental concept in the Linux and UNIX file system. Each object in the file system is represented by an inode.
![Page 23: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/23.jpg)
File Information
• File type (executable, block special etc)=> Permissions (read, write etc)=> Owner=> Group=> File Size=> File access, change and modification time (remember UNIX or Linux never stores file creation time, this is favorite question asked in UNIX/Linux sys admin job interview)=> File deletion time=> => Access Control List (ACLs)
![Page 24: File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.](https://reader030.fdocuments.in/reader030/viewer/2022032705/56649dd35503460f94ac9d61/html5/thumbnails/24.jpg)
Inode
• All the above information stored in an inode. In short the inode identifies the file and its attributes (as above) . Each inode is identified by a unique inode number within the file system. Inode is also know as index number.