EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login
Home Software Development Software Development Tutorials Unix Tutorial Unix File System
Secondary Sidebar
Unix Tutorial
  • Advanced
    • Array in Unix
    • Functions in Unix
    • Unix File Permissions
    • Unix File System
    • Unix Shell Commands
    • Crontab in Unix
    • egrep command in Unix
    • For Loop in Unix
    • VI Editor in Unix
    • What is Unix Shell
    • Gnome Development
    • UNIX interview questions
    • Cheat sheet for UNIX
    • Unix Sort by Column
    • Find Command in Unix
    • Gnome Version
  • Basic
    • What is Unix
    • Uses of Unix
    • Career In Unix
    • Install UNIX
    • Unix Architecture
    • Unix Commands
    • VI Command in Unix
    • AWK Command in Unix
    • Paste Command in Unix
    • SED Command in Unix
    • Sort Command in Unix
    • WHO Command in Unix
    • Unix Operators
    • UNIX Administrator

Unix File System

By Aanchal SinghAanchal Singh

Unix File System

Introduction to Unix File System

Unix File System can be defined as a framework that organizes and stores a huge volume of data that can be handled with ease. It involves elements like file which is a collection of related data that can be viewed logically, appears as a stream of bytes, with attributes containing information in relation to the concerned file. The file system consisting of two main components i.e files, directories. The entire system following a hierarchy in which directories act as special files that contain multiple files with the highest-level directory in the entire hierarchical structure being termed as root which is symbolically denoted by ‘/’.  There can be many subdirectories under this directory.

The Unix Filesystem usually has below directories present in the file system.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

  • bin: It is a short form for binary files. This directory stores the commonly used executable commands.
  • mnt: This contains information regarding the mounted devices.
  • root: This is the root user’s home directory.
  • tmp: This is a storage for temporary files. As they are temporary they are removed periodically from the filesystem.
  • usr: It contains a set of executable commands
  • home: It has a collection of directories and files.
  • proc: It contains files that are related to system processes.

What is Unix?

Unix is an operating system which has been applied to the family of multitasking, multiuser computer operating system. It was derived from AT&T UNIX operating system and was developed in the 1970s at the Bell Labs research center. It was first programmed in assembly language and again reprogrammed in C. It is stable and also provides a graphical user interface which helps in providing an easy to use environment. Unix provides users with different program development tools, electronic communication facilities and also many development tools. With these, it also provides multiple UNIX shells where one interprets your commands and those are passed to the operating system. It also has a kernel which acts as a mediator between the shell and the hardware. Kernels are relatively small and efficient. Unix also provides a separate file system where many functions can be performed. Let us have a look at the file system.

Types of Unix File System

The Unix File System consists of different types of files. Let us have a look at these.

1. Ordinary Files

These files are used to store information of the users. It may be some text or any image which is stored. It is normally located under a directory and does not contain any other files.

2. Directories

Directories help in organizing the files which are present. The directories can contain ordinary files, special files or even other directories. All these directories are the descendants of the root directory.

3. Special Files

The special files are used to represent physical devices like printer, tape driver or a terminal. Unix considers any device to be a file. Even the terminal is considered to be a file. It is considered as standard input file from where input is read. This terminal is also the standard output file which is the command’s output.

4. Pipes

To link commands Unix provides pipes. The pipe is a temporary file. This also holds data from one command which is kept until it is read by another command. The output of one command is given to the next command as an input.

File Descriptor and Inode

There is clear segregation between the contents of the file and the information which is present in the file. All files consist of a sequence of characters except for the device and special files. The information which is needed in the filesystem to handle the files is included in a data structure which is called inode. The inode is used to identify a file. A few attributes must be provided to handle the kernel and filesystem functions. To name a few the attributes are file type, device id, user id of file owner, access rights and file mode, etc.

Additional File Attributes in Unix File System

A file can have some additional attributes as below.

  • Permission modes: It tells the permissions which are assigned to a file for the owner.
  • Owner: This is the owner of the file.
  • Group: This specifies the groups associated with that file.
  • File Name: It is the name associated with the file.
  • Modification date: it was the date when the file was last modified.
  • Size: The size of a file in bytes is specified.
  • Number of links: The files which relate to a particular file.

File and Directory Commands in Unix File System

There are many commands which are provided by UNIX which help in working with files. A few of these commands are listed below.

1. ls: It lists all files in a particular directory.

It has a few variations below.

  • ls dir: Shows the contents present in a directory.
  • ls a: It shows all files including the hidden files.
  • ls -al: It gives a detailed listing of all contents of the file.

2. Less: It displays less number of lines rather than the complete file.

3. Head: It displays the first few lines or n lines of the file.

4. Tail: Displays the last few lines or n lines of the file.

5. Cat: It displays the contents of the entire file without the pagination of the file.

6. cp: It copies the contents of one file to another. It overwrites the contents of the file if not mentioned otherwise.

7. mv: It moves the specified files to the specified destination.

8. rm: Removes or deletes the specified files.

Conclusion

Unix is an operating system that handles files in an organized way. With all the commands and functions managing files is very easy. It also has permissions that limit access to the files. Only authorized people can access the files and perform different operations. It also has different kinds of files segregated which makes it easier to use. The file system of Unix is hence considered to be one of the most user-friendly file systems.

Recommended Article

This has been a guide to Unix File System. Here we discuss its file attributes along with file descriptor and Inode. You can also go through our other suggested articles to learn more –

  1. Unix Architecture
  2. Uses of Unix
  3. Functions in Unix
  4. Unix Operators
Popular Course in this category
Red Hat Linux Training Program (4 Courses, 1+ Projects)
  4 Online Courses |  1 Hands-on Project |  29+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Linux Training Program (16 Courses, 3+ Projects)4.9
Kali Linux Training (3 Courses, 3+ Projects)4.8
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more