Permissions for folders and files in Linux


To begin with, it should be noted that in a UNIX system (also applicable to Linux systems), anything that is not a file then it is a process. Linux does not make any difference between a directory and a file, because the directory is nothing but a file that contains the names of other files. Almost everything we encounter in a Linux system is a file; if it is not a file then it is a process.

File types in Linux

Directories: files that contain a list of other files;
Special files: the mechanisms used to enter commands and return responses (most special files are in /dev);
Links: is the way a file or a directory is made visible in several parts of the file system;
Sockets (for domains): A special kind of files, similar to TCP/IP sockets, which ensure the deployment of network processes protected by access control over the file system.
Pipelines: they behave more or less like sockets and forms a way for process communication.

To display the content of a directory and the type of each file, use the ls command with the -l option:

[email protected]:~/Desktop$ ls -l
total 52
drwxrwxr-x 4 mvps mvps 4096 jun 20 02:43 vps
-rwxrwxrwx 1 mvps mvps 93 jun 19 12:32 HO_script
-rw- r—– 1 mvps mvps 37126 jun 25 03:15 ubuntu.jpg

The above command executed in the Desktop folder of the mvps user shows that the folder contains the folder named ‘vps’, but also two files: HO_script and ubuntu.jpg. The first character shows the file type as follows:

Now I think you will no longer have trouble understanding the permissions of a file or directory that represents the owner, group, and others.

Recent Posts