File Attributes in Linux - BunksAllowed

BunksAllowed is an effort to facilitate Self Learning process through the provision of quality tutorials.

Community

File Attributes in Linux

Share This


File Types

Unix or Unix-based systems support many types of files.

Regular Files

The most common type of file is a regular file. Regular files can store any kind of data like plain text files, application files, or special binary files. The file type can be determined by the file command, as shown below.

Symbolic Links

A symbolic link is a special file pointing to another file in the system. You can check the symbolic link using ls -l command as shown below.

To create a symbolic link use the ln command as shown below.

The first argument is the source file and the next argument is the target link.

Device Files

Device files are the gateway to the respective devices. To access devices in Unix-based systems read and write operations are performed on device files. The device files are located in /dev directory.

There are two types of device files: i) character special and ii) block special files.

Permissions

In Unix, environment permissions are very important in the security aspect. With respect to every file owner, group, and other permissions are set and should be verified for security reasons. The following commands are used to manage these permissions.

Three types of actions can be performed on a file. These permissions are read, write and execute. To check current permissions on a file ls -l command is used.

The first three characters represent owner permissions, next three characters represent group permissions (which can be performed by other group members) and last three characters represent other permissions (global permissions). The actions are described below.

r (read) the user can view the content.
w (write) the user can write content in the file.
x (execute) the user can execute the file.

chmod

This command is used to change permissions. If the owner of the file or the root user wants to change these permissions, the user can run the command as shown below.

chown

This command is used to change the ownership of a file.

chgrp

This command is used to change the group of the file.



Happy Exploring!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.