Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

File system discovery


Published on

File system discovery by mohamed elshawaf @devent 3

Published in: Technology
  • Be the first to comment

File system discovery

  1. 1. File System Discovery BY Mohamed Elshawaf
  2. 2. Question ?• What do you know about • File System ? •
  3. 3. What is file system ?● Method of storing and organizing computer files and their data.● Essentially, it organizes these files into a database for the storage, organization, manipulation, and retrieval by the computers operating system. Eg:- fat, ntfs, ext4, ext3.......
  4. 4. What is file system hierarchy ? To put it simply, it can be visualized as a tree with its roots and all. At the top of the hierarchy is invariably the root path which is represented by / and all other directories are created beneaththis root path in linux.
  5. 5. Different from Windows .Windows starts with drives, which are• explicit• – C:• – D:
  6. 6. Root !!•In Windows, every drive has its ownroot C: is the root of the C drive•In Linux, there is only one root, nomatter how many drives you may have•– In Linux, / is the root•Root is ambiguous in one respect, sinceit can refer to the top of the filestructure, and is also the name of theAdministrator type account in Linux.
  7. 7. Attention•Windows uses a backslash for everything•Linux uses a forward slash for everything•In Windows, the logical drive (e.g. C:) is animportant part of the directory structure•In Linux, logical drives dont mean much. Youcan even mount a separate•physical drive under a directory that is onanother drive.•In Windows, case does not matter•In Linux, everything is case sensitive.
  8. 8. Drives vs. directories•In Windows, drives are directories•In Linux, you can have several drives•all under one overall directory
  9. 9. Standard?•Distros can vary, but so can programs•When you install a program, it may notfollow the FHS in deciding where toplace its files
  10. 10. /•This is the symbol for the root of the filesystem in Linux•Every directory is “under” root,ultimately•This is not the same as the user “root”,which is the user with God-like powersover the system•The user “root” does have a directory,called /root
  11. 11. Let’sZoooooooooooom
  12. 12. /bin•Contains many of the commands usedon the command line•Examples include cat, chmod,dmesg,kill, ls, mkdir more, ps, pwd, sed, su•the above commands, and manyothers, must be in /bin to meet thestandard.•Other commands can be optionallyincluded, such as tar. gzip, netstat, andping
  13. 13. /boot•Contains files needed for boot• – kernel• – Grub menu (good to know if you aredualbooting)• – Lilo boot sector backups•Contains data that is used before thekernel starts executing user-modeprograms
  14. 14. /dev•Kinda-sortaan equivalent to a mashupof the Device Manager andC:WindowsSystem in Windows•Containsa file describing every device,and these files can send data to eachdevice•InLinux, everything is a file or adirectory
  15. 15. /dev 2•hda1, hda2, etc. are partitions on thefirst physical IDE drive•sda1, sda2, etc. are partitions on thefirst physical SATA drive•/dev/cdrom is the optical drive•/dev/fd0 is the floppy drive, if you haveone•/dev/dsp is the speaker device
  16. 16. /etc•Perhaps the most important to understand•No binaries can be here, per the standard•This is just for configuration files•Examples include /etc/inittab, /etc/fstab ,/etc/passwd , /etc/hosts, /etc/x11, and /etc/opt
  17. 17. /etc 2•These files are generally text files andcan be edited using any texteditor:emacs or vi on the command line,or whatever graphical equivalent (e.g.gedit, kate) your desktop offers
  18. 18. /etc/inittab•Describes what takes place at bootupIncludes the runlevel of the system, andwhich processes should be run at eachrunlevel•Linux has seven runlevels, from 0-6
  19. 19. /etc/fstab•Automatically mounts file systemsacross multiple drives or partitions, oreven from remote systems•Thisfile tells the system what drive toaccess, and where to mount it in yoursystem
  20. 20. /etc/fstab•Automatically mounts file systemsacross multiple drives or partitions, oreven from remote systems•Thisfile tells the system what drive toaccess, and where to mount it in yoursystem
  21. 21. /etc/hosts•This is the famous hosts file, whichmatches up names with IP addresses•Thisis like level 1 DNS. The systemlooks here first.•Thiscan be used to block sites byputting their URL in here
  22. 22. /etc/passwd•This is the password file, but it containsmore: user name, user password, userID, group ID, home directory, and shell.•It can optionally contain the users “realname”•Each user is on its own line•Each user can select the shell they wantto use (most use bash these days)
  23. 23. /etc/opt/•This is a directory for the configurationfiles for each system application youinstall.•Each application gets its ownsubdirectory under /etc/opt/
  24. 24. /etc/x11•Configuration directory for x11, which isthe display system for graphicalinterfaces in Linux•This can vary with different distros, soagain you need to check•/etc/x11/xorg.conf is the configurationfile that lets you specify the resolutionsyour monitor and graphics card candisplay, for instance
  25. 25. /home•This is where the home directories forall of the “ordinary” users are located.•The exception is root, which has its ownhome directory, /root/•Each user gets a directory with theiruser name: e.g. /home/devmix•This can contain configuration files forapplications that are user-specific
  26. 26. /home Partition?•Your home directory is where you•would place all of your documents,videos, MP3s, etc.•It can get fairly large•It is also the stuff you want to back up,and you dont want to lose•Putting it on its own partition, or evenits own physical drive, is not a bad idea
  27. 27. Reinstalling•If you have a separate /home partition,you can reinstall (or do a clean upgrade)and still keep not only your data, butmany of your file configurations
  28. 28. /lib•This is the location for shared libraryfiles that are used by system programs•Shared library files are equivalent toWindows “*.dll” files•The files here are intended to belibraries for programs in /bin and /sbin,i.e. needed to boot the system and runthe commands in the root file system
  29. 29. /lib 2 ••Also in this directory are kernelmodules•Other library locations for otherprograms include /usr/lib and/usr/local/lib
  30. 30. /media, /mnt•Either directory can be a place tomount removable media (e.g. CD, USBdrive, Floppy disk)•/mnt is the older way, and is still usedfor temporarily-mounted file systems•Most current distro versions will mountthese devices automatically
  31. 31. /opt•Intended as a place for “optional”software, i.e. add-on packages that arenot part of the default installation
  32. 32. /proc•Have we mentioned that everything inLinux is a file or a directory?•Any time a process is created in Linux,a corresponding file goes in here•Gosh, what would happen if you deleteda file here?
  33. 33. /root•Home directory for the root account•Normally,you dont want to be root,and you dont want to go here
  34. 34. /sbin•Placefor System binaries•One of three such directories  – /sbin  – /usr/sbin  – /usr/local/sbin•Allthree hold utilities used for systemadministration, and are intended for theroot user like for booting, restoring,recovering, and/or repairing the system
  35. 35. /tmp•Guess what this one is?•Yes, temporary files are placed here•Assume that anything in this directorywill be deleted whenever the system isbooted•If you want to have your own temporarydirectory and not lose files at reboot,create one in your home directory,i.e. /home/username/temp
  36. 36. /usr•Lots of stuff in here•Back in the mists of prehistory, thesewere the user directories, equivalent towhat are now /home directories•Now /usr is for shareable data•Not intended for software packages, ingeneral
  37. 37. /usr/bin•Contains executable files for manyLinux commands•These are commands that are not partof the core Linux operating system•They would go in /bin•Examples of commands in here: perl,python
  38. 38. /usr/include ••General use include files, includingheader files, for C and C++programming languages
  39. 39. /usr/lib•Contains libraries for the C and C++programming languages•Object files, libraries, and internal filesnot intended to be executed directly byusers or shell scripts
  40. 40. /usr/local•For use by System Administrator wheninstalling software locally•Must not be over-written when systemsoftware is updated•Generally has same subdirectories as/usr
  41. 41. /usr/sbin•Non-essential standard system binaries,i.e. utilities•Essential utilities go in /sbin
  42. 42. /usr/share/man•Primary location for man pages for thesystem
  43. 43. /usr/src•Source code is placed here, forreference purposes only•Thisincludes the source code for theLinux kernel
  44. 44. /var•This is for files that are expected to beupdated and changed•This includes:• – mail directories• – print spool• – logs• – web sites
  45. 45. /var 2•Because these can be written toconstantly, they can grow over time•On a server, you may want to put /varon its own partition to limit the growth•This can also prevent the /var directoryfrom bringing down the server by usingup all of the drive space.
  46. 46. /var/lock•Contains lock files•These files prevent two users (or two•programs) from trying to access thesame data at the same time•You may need to delete a lock file fromtime to time
  47. 47. /var/log ••Contains the log files generated byprograms
  48. 48. The end ☺