As the saying goes ‘Everything in Linux is a file, if something is not a file, it is a process’. It is indeed a quite factual and posolutely a well ratified generalization. A Linux system considers folders, programs, services, texts, images, I/O devices, and generally all devices as files. Files in Linux can be typified generally into 3 main groups, namely: 1. Regular Files 2. Folder Files 3. Special Files Regular Files: All normal files in the file system, which do not have an imposed internal file structure by the Linux system, are generally Regular Files. The internal file structures of these files are governed by the respective programs which use them. The structure and interpretation thereof is exclusively reliant on how the file is deciphered by the pertinent software. Identifying Regular Files: If the Linux file system permissions start with hyphen “-“, then it is a regular file. The file system permissions are displayed when a long listing is requested with ‘ls –l’ command. We can list all the regular files by giving the following command in a bash shell:
The test command can also be used to check if a file is a regular file as shown below:
To check if the file type for all the files in a given directory are regular files we can use a simple ‘for loop’ as depicted below:
‘stat’ is another command which can throw sufficient light about all aspects of a file including its type. Check the usage shown below:
Content Courtesy: Mr. Lijo Joseph | Manager | Technical Services | Ipsr Solutions ltd.