Basic Commands
and Simple Shell Scripts68
The structure of the permissions can be seen in the following diagram:
Figure 3.5 – The permissions structure for Linux
Let’s discuss the preceding structure The first character is for any special permissions that the file may have. If it is a regular file and has no special permission (as in this case, it will appear as -.
• Directories will appear with d. Consider that in Linux,
everything is a file, and directories area file with special permissions Links, usually symbolic links, will appear with l. These act as a shortcut to a file from a different directory Special permissions to run a file as a different user or group, called
setuid orb setgidb, will appear ass A special permission so that only the owner can remove or rename a file, called ab sticky bit, will appear as t.
The
next three characters, rw-, are the permissions
for the owner The first one, r, is the read permission assigned The second one, w, is the write permission assigned The third one, x, not present and shown as -, is the executable permission. Note that executable permission for directories means being able to enter them.
The next three characters, ---, are for the group permissions and work the same way as the owner permission. In this case, no group access is granted.
The final three characters, ---, are the permissions for others, which means users or groups do not show as the ones assigned to the file 1:
This indicates the number of links (hard links) to this file. This is intended, among other things, so that we do not delete a file used in another folder root (the first instance This indicates the owner of the file.
Using the command line,
environment variables, and navigating through the filesystem
69
• root (the second instance This indicates the group assigned to the file 1393: This indicates the size in bytes Dec 7 16:45: This indicates the date and time that the file was last modified anaconda-ks.cfg: This indicates the filename.
When we list a directory (referred to in other systems as a folder, the output will show the contents of the directory itself. We can list the info for the directory itself with the -d option. Let’s now take a look at etc, the directory that stores the system-wide configuration:
Share with your friends: