Directory Structure or File system structure of the Unix

Lists of Questions Answers and Short Study Notes

  • (1) Explain the directory Structure or file system structure of the Unix

 

Question-1 Explain the directory Structure or file system structure of the UNIX

  • The initial Linux file system was the MINIX 1 file system. However, infect it limited file names to 14 characters and its maximum file size was 64 MB.
  • The first improvement was the ext files system which allow file names of 255 characters and file size of 2 GB, but it was slower than MINIX 1 file system so the ext 2 file system was invented, with long file name, long file, and better performance and it has became the main file system.
  • A Linux file is sequence of 0 or more bytes containing arbitrary information. No distinction is made between ASCII file, binary file or any other kinds of the file.
  • File names consists of a based name and an extension, separated by a dot. For example prog.c is c program anprog.o is an object file. Extension may be of any length and file may have multiple extensions, for example prog.java.gz is a compressed java program.
  • File can be grouped together in directories. Directories are stored as a files and it can be treated like files.
  • The / characters is known as the root directory and also use to separate directory names.

 

Some important directory found in most Linux systems

Directory Contents
bin Binary (executable) programs
dev Specials files for I/O devices
etc Miscellaneous system files
lib Libraries
usr User directories

 

There are 2 ways to specify file names in Linux.

1 Absolute path

  • It tells us how to get the file starting at the root directory. For example / usr/ eradar/osquestion/ introductopm/ques-1 . This tells system to look in the root directory for an usr directory. Then looks for the directory eradar. The eradar directory contains osquestion and directory which contains the introductopm directory which contains the file ques-1.

 

2 Relative path

  • Absolute path name are often long and inconvenient for this reason Linux allows the users to designate the directory in which they are currently working as the working directory. A path name specified relative to the working directory is a relative path. For example if / usr/ eradar /osquestion/quest is the working directory then the command.

cp quest backup -10

  • It has exactly the same effect as the following longer command.

cp /usr/eradar/osquestion/quest

  • For example if two user are sharing a file it will be located in directory belonging to one of them so the other will have to use an absolute path name to refer to it.
  • If this is long enough it may become irritating to have to keep typing it so the Linux provides a solution to the problem by allowing the users to make a new directory entry that points to an existing file such an entry is called a link.
  • For example consider a situation as shown in the figure. Fred and Liza are working together on project and each of them needs access to the other files. If fred has /usr/fred as is working directory then he can refer to the file x in Liza’s directory as /usr/liza/x. alternatively Fred can create a new directory in his directory as in the figure.

linking in unix

Figure A – Before Linking

Figure B – After Linking