The syntax format for the Chown command is:
chown [Options] User or group file 1[file 2 ...]
The user can be a user name or a user ID. A file is a space-separated list of files for which you want to change permissions, and you can use wildcard characters to represent file names. If you change the ownership of a file or directory, the original file will no longer have permission to the file or directory. System administrators often use the Chown command to give users permission to use the file after copying it to another user's directory.
Under Linux, each file belongs to a user group at the same time. When you create a file or directory, the system gives it a user-group relationship that can be used by all members of the user group. The flag for a file user group relationship is a GID. A file's GID can only be modified by the file master or Superuser (root). The CHGRP command can change the GID of a file, and its syntax is in the following format:
CHGRP [option] group filename
Where group is the user group ID. The file name is separated by a space. To change the list of files in a group, it supports wildcards.
Each file and directory in a Linux system has access permission to determine who can access and manipulate files and directories in any way. Access rights specify three different types of users: the file Master (owner), the same group of users (groups), and other users who can access the system (others).
Access rights specify three ways to access a file or directory: Read (R), write (w), executable, or find (x).
When you display the details of a file or directory with the Ls-l command or the L command, the leftmost column is the file's access rights. The meaning of each of them is as follows:
* File access rights
Read permission (r) means that only the specified user is allowed to read its contents, and no changes are prevented from doing so. You need Read permission to use the contents of the file you are accessing as an input command. For example: Cat, more and so on; Write permission (W) indicates that the specified user is allowed to open and modify the file. such as command VI, CP, etc.; Execute permission (x) allows the specified user to execute the file as a program.
* Directory access rights
With the-D option after the LS command, you can understand the permissions of the directory file:
Ls-d
Read permission (r) lists the files stored in the directory, that is, the Read directory contents list. This permission allows the shell to list matching filenames using file name extension characters; Write permission (w) indicates that you are allowed to delete or add new files from the directory, usually only the owner of the directory has write permissions; execution permission (x) allows you to look in the directory and can use the CD command to change the working directory to that directory.
The main function of CAT commands can be grouped into four kinds:
1. Used to display the contents of a file, mainly used to read less information
Command form: Cat filename
For example:
Cat/data/www/robots.txt View details of/data/www/robots.txt files
Cat-n *.php to display all the PHP files in the current directory (in order)
Cat-n/data/www/robots.txt View the details of the/data/www/robots.txt file and add the line number
2. Create a file (you can only create new files, you cannot edit existing files)
Command form: cat > FileName
For example:
Cat >/data/www/robots.txt Create/data/www/robots.txt files
cat/data/www/index.php >/data/abc/index.php/data/www/index.php The contents of this file into the/data/www/index.php file.
Cat-n/www/index.php >/abc/index.php/www/index.php The contents of this file with the line number entered into the/www/index.php file.
3. Merging several files into one file
Command form: Cat file1 file2 > file
For example:
Cat-b/www/index.php/www/about.php >>/www/abc.php Input the contents of/www/index.php and/www/about.php files to/www after the line number (ignoring blank lines) /abc.php This file (note that the abc.php is not there originally)
cat/data/www/*.php > index.php merges all the PHP files in the/data/www/*.php directory into index.php (note here index.php is a file in *.php)
4. Empty the contents of the document:
For example:
Cat/dev/null >/data/robots.txt This is the contents of the empty/data/robots.txt file
Some other tips on cat commands.
Cat/proc/cpuinfo display information about CPU info
Cat/proc/interrupts Show interrupts
Cat/proc/meminfo Check Memory usage
Cat/proc/swaps shows which swap is used
Cat/proc/version Displays the kernel version
Cat/proc/net/dev Display network adapters and statistics
Cat/proc/mounts Displays the loaded file system