Which files formats are considered regular files in Ubuntu?
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 :
- Which file formats are considered regular files in Ubuntu ?
- Which file formats are considered non-regulat files in Ubuntu ?
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 filenameIf 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.