Top Banner
File System and Directory Structure in Linux
24

File System and Directory Structure in Linux

Feb 09, 2016

Download

Documents

Serena Poletto

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 placed logically for storage and retrieval. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: File System and Directory Structure in Linux

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 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

logical file structure

physical representation on disk

Page 4: File System and Directory Structure in Linux

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

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

Inside File System

• User Data• Meta Data

Page 7: File System and Directory Structure in Linux

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
Page 9: File System and Directory Structure in Linux

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

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

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

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

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

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

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

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

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

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

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

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

14. /mnt – Mount Directory

• Temporary mount directory where sysadmins can mount filesystems.

Page 22: File System and Directory Structure in Linux

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

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

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.