The operating system provides the file system to organise a data by grouping of files on the disk. The UNIX file system has a hierarchical structure of directories and stores the files in these directories. The file system begins with the directory called root. The root directory is denoted by, and it contains a file called UNIX, which is the UNIX kernel file. The sub-directories that are present in the root directory are bin, lib, usr, etc, tmp, and dev. Table describes the sub-directories present in the root directory.
Directory | Contains |
---|---|
bin | The bin directory contains executable files for most of the UNIX Command. |
lib | The lib directory contains all the library functions provided by UNIX. The programs written in UNIX make use of the library function in lib directory. |
dev | The dev directory contains files that control various input/output devices, like terminals, disk drives, and printer. Each device has a separate file in the UNIX. |
etc | Binary executable files are required for system administration. |
tmp | If contains temporary files created by UNIX users. |
usr | Home directory of all users. |
/usr/bin | Additional binary executable file. |
The benefits of the file system are as follows:
- The UNIX file system has a hierarchical file structure. Files can grow automatically.
- Files have access permissions.
- All devices are implemented as files.
There are various types of files in UNIX, which are:
• Ordinary Files: The files created by the end user come under this category of files, such as all the data files, program files, object files and executable files. An end user can make changes to such files.
• Directory Files: These files are created automatically when directory exists. This file has same name as the directory name, and contains information about the files under the directory. For example: /home/tom, that means tom is a directory under /home, which contains information on all the files and directories under the directory, tom.
• Special files: Special files are associated with input/output devices. That is found in standard UNIX directories. such as /dev and /etc. The end-user has no right to alter this file.
Read Also :
UNIX File Types
File Type :
- Ordinary File
- Directory Files
- Special Files
Special Files :
- Character Special Files
- Block Special Files
- Hard Links
- Symbolic Files
A filename allows you to access a file for doing different operations, such as reading, writing, and running a file.
UNIX support the different type of special files:
• Character Special Files: Reads and writes data one character at a time, such as modem.
• Block Special Files: Accesses a block of data at a time. A block of data can be either 512 or 1024 bytes. The kernel collects the data in a memory for block memory and makes it available for the end-user. This makes input/output operation faster; hard disk is an example of block device.
• Hard Links: Allows a single file to have multiple names. Hard links are only for a file, not for a directory. They create a direct link to an inode. Each file in a filesystem has an inode which it identifies by an inode number. You can do hard link to only that file which is in the same file system.
• Symbolic Links: Are similar to hard links except that symbolic links work across different file systems.
Filename
A filename allows you to access a file for doing different operations, such as reading, writing and running a file. The characteristics for naming a file in UNIX operating system are:
- File name should be up to 255 characters long. This restriction is only on file name, not on the path name.
- File name can contain any character except ("/") forward slash.
- File name in UNIX is case sensitive.
- File name should not have components and extension. You can use as many dots as you need, up to 255 characters.
- File name should not have a blank or a tab.