Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

Which files formats are considered regular files in Ubuntu?

Writer Andrew Mclaughlin

S_ISREG() is a macro used to interpret the values in a stat-struct. From man page it states :

S_ISREG(m)
is it a regular file? // Macro checks, if the file is regular or not.

Questions :

  1. Which file formats are considered regular files in Ubuntu ?
  2. Which file formats are considered non-regulat files in Ubuntu ?
1

1 Answer

To understand what is a "regular file" you need to understand that in UNIX-like operating systems, "everything is a file".

Basically, a regular file is any file that is not a special file.

To determine whether or not a file is a regular file or not, you can use the command:

ls -ld filename

If the first character of the output is a -, then it is a regular file.

Here are a few examples:

$ ls -ld /dev/null
crw-rw-rw- 1 root root 1, 3 Nov 24 22:26 /dev/null
$ ls -ld /home/
drwxr-xr-x 1 root root 512 Oct 10 21:56 /home/
$ ls -ld /etc/apt/sources.list
-rw-r--r-- 1 root root 2743 Aug 4 14:42 /etc/apt/sources.list

/dev/null is a character device file.

/home is a directory.

/etc/apt/sources.list is a regular file.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy