Home > Article > Operation and Maintenance > How to check which user a file belongs to in centos
In centos, you can use the ls command to check which user the file belongs to. This command is used to display the contents of the specified directory. When the parameter is set to "-l", you can display the file shape, file permissions and file Owner and other information, the syntax is "ls -l [name...]".
The operating environment of this article: centos 7 system, Dell G3 computer.
In Linux systems, it is often necessary to change the permissions of files. At this time, viewing and modifying the user and user group to which the file belongs is also a very important operation. You can use the following command to view the users and user groups to which all files in a folder belong and their corresponding permissions.
ls -l
Taking my local upload folder as an example, the effect is as shown below:
If you want to modify the user and user group to which a file belongs, you need to use the chown command. You can modify the user group to which the file belongs by using the following command:
chown username file
Among them, username is The user to whom the modified file belongs, file is the file you want to operate. The effect is as follows:
The user group and user to which the file belongs can be modified at the same time through the following commands:
chown username:username file
Among them, the two usernames are new user groups respectively. and users, the effect is as follows:
Recommended tutorial: "centos tutorial"
The above is the detailed content of How to check which user a file belongs to in centos. For more information, please follow other related articles on the PHP Chinese website!