×

How many types of files are there in Linux

You will undoubtedly come across several file types when browsing the Linux file system. Regular files and directories are the most common and evident file formats. But with an additional five file types, the Linux operating system has more to provide in terms of file kinds. This brief essay will assist you in identifying each of the seven file formats found in the Linux operating system.

Following are the different types of files in the Linux Operating System.

  • -: regular file
  • d : directory
  • c : character device file
  • b : block device file
  • s : local socket file
  • p : named file
  • |: symbolic link

What is a Regular File?

One kind of file kept in a file system is a regular file. The word "regular" is used to set it apart from other unique sorts of files.

Regular files make up the majority of files utilized directly by humans. Regular files include things like image files, text files, and executable files.

The kernel does an operation in accordance with the filesystem's rules when reading or writing data to a normal file. Writes, for example, might be journaled, postponed, or subject to other particular actions.

The most prevalent file type on a Linux system is a regular file, which can be created with the touch command as follows:

$ touch linuxcareer.com
$ ls -ld linuxcareer.com
-rw-rw-r—1 lubos lubos 0 Jan 7 12:50 linuxcareer.com

The initial character of the ls command, in this example "-," stands for the regular file's identifying code. The rm command can be used to delete a common file:

$ rm linuxcareer.com
$

Differences between how UNIX and other operating systems handle regular files and directories.

Regular Files

Anything that does not belong to the unique file types we will discuss below is a regular file. All regular files under UNIX are kept as collections of bytes. UNIX does not distinguish between text files and binary files, in contrast to several other operating systems. Furthermore, with UNIX, file "extensions" are meaningless. The management of all filename extensions follows convention. For instance, the majority of C compilers require programs to have the file.c file extension, yet the operating system does not give.c files any special treatment. Various file extensions, including file.tar.gz, are possible.

Directories

A directory file includes a list of all the files it contains. As we've seen, directory files are identified in ls -l listings by a d in the string's first place (for example, drwxr-xr-x).

The two types of files you will work with the most frequently are normal files and directories, which is why we have focused on them thus far in this course. However, because of the UNIX "anything is a file" tenet, there are numerous other objects that resemble files but differ in some important ways.

Regular Files are of how many types?

Regular Files are of two types that are text files and binary files.

1) Text Files

Text files are common files that are viewable by users and store data in ASCII text format. These files can be printed and displayed. A text file's lines cannot contain NUL characters and cannot be longer than LINE MAX bytes, including the newline character.

Incorporating command or other nonprintable characters into a text file is not prohibited by the term text (other than NUL). As a result, common tools that specify text files as outputs or inputs can either handle special characters or explicitly state their limitations in each section where they apply.

2) Binary Files

Regular files called "binary files" contain data usable by computers. Binary files may include executable code that directs the system to carry out a task. Executable, binary files are where commands and programs are kept. Binary code is produced from ASCII text using specialized compilation software. The main distinction between text and binary files is that text files have lines with a length of less than LINE MAX bytes, no NUL characters, and a newline character at the end of each line.

How file types are declared in Linux Operating System?

File types in the Linux kernel are listed in the header file sys/stat.h. Each Linux file type's type name, symbolic name, and bitmask are mentioned below.

Type NameSymbolic NameBitmask
Regular fileS_IFREG  0100000
DirectoryS_IFDIR  0040000
Character deviceS_IFCHR  0020000
Block special deviceS_IFBLK  0060000
SocketS_IFSOCK  0140000
FIFO (named pipe)S_IFIFO  0010000
Symbolic linkS_IFLNK0120000

Related Topics

What is a Server?

The computer which processes the request and delivers the data to the other client over any network is called a Server. The server could be local or internet. These are specialized...

6 minutes read.

Types of Network

“The computer network is a set of computers connected to share resources.”An internet itself can be considered the computer network. In computer networks, the computing devices exchange the data with each...

3 minutes read.

What is the Print Screen Key?

Print Screen is one among many keys which is present on the keyboard. It is abbreviated as PrtScr, Prsc,r, PrtScrn, PRTSC, PrntScrn, Ps/SR. When this key is pressed, it sends...

3 minutes read.

How to fix a not a valid Win32 application error

The “not a valid Win32 application” error occurs on Windows. Users get confused when they see it. It means our current version of windows does not support or is not...

5 minutes read.

Difference between Optical Fibre and Coaxial Cable

What is Optical Fibre Cable? Optical fibre cables are thin, transparent glass or plastic strands that transmit data through light signals. They are commonly used in telecommunications and internet infrastructure, as...

7 minutes read.

What is a Cold Boot?

A cold boot is a process of starting a computer from a completely powered-off state. It is also known as a hard boot. The computer goes through a series of...

8 minutes read.

What is the Pg up Key (Page up Key)

The Pg Up key is a computer key located between the keyboard and the numeric pad or on the numeric pad number 9. It can also be referred to as...

2 minutes read.

Difference between Website and Webpage

Website A website is a collection of attached web pages, typically supplied from a single web domain, accessible via the Internet. A website is hosted on a computer system known as...

6 minutes read.

What is Multitasking?

Multiple programs can be run simultaneously, thanks to this logical expansion of a multiprogramming system. In a contemporary computer system, the word "multitasking" is employed. The ability to multitask in...

4 minutes read.

What is a Dynamic Website?

There are two types of websites. First static and second dynamic website, but before we go for dynamic, we should know about the static website so that you can easily...

4 minutes read.

Third Generation of Computer

The period of the third generation was from 1965 – 1971.  The integrated circuits are used in the computers of the third generation. The transistors are not used in these computers....

5 minutes read.

Computer Pioneers and people who are CEO

The world of technology has been shaped by several individuals who have made significant contributions as computer pioneers and CEOs of technology companies. This article will take a deeper look...

42 minutes read.

Autoexec.bat and config.sys Information

Basically, the Config.sys and Autoexec.bat files are made for MS-DOS and Windows 3. x to load the device and operating system to work effectively. The most recent versions of MS-DOS...

7 minutes read.

Why am I unable to increase the resolution in Windows?

If you cannot raise the display resolution in Windows, take these actions. Identifying and resolving video driver issues If Windows doesn't let you raise the screen resolution, your video drivers can be...

3 minutes read.

How to fix a CMOS checksum error?

A CMOS checksum error is a conflict between the CMOS and BIOS, which can occur when the computer is booting up. The CMOS is a chip on the motherboard that...

9 minutes read.

What is Cable Modem?

A common piece of gear that links computers to your ISP is the cable modem. A cable modem, unlike other types of modems, uses coax cable to proxy that connection...

7 minutes read.

What is Asynchronous DRAM?

Asynchronous DRAM (Dynamic Random Access Memory) is a type of memory that operates independently of the system clock. It is not synced with the computer system clock; therefore, it is...

5 minutes read.

What is WAP?

WAP or Wireless Application Protocol was released in 1999. This protocol allows users to communicate through a wireless network such as mobile phones, tablets, etc. This protocol became quite popular...

12 minutes read.

How to shut down a computer

Whenever the Shutdown is done, all the programs, software, files, and operating system are shut down. The RAM is cleared, so before shutting down the device, the user should ensure...

4 minutes read.

What is a capacitor?

A capacitor is a passive electrical component that stores energy in an electric field. It comprises two conductive plates separated by a non-conductive material called the dielectric. When a voltage...

6 minutes read.