chmod
Function: Change the permissions of the file.
Syntax: chmod [-r] XYZ file or directory (numeric type changes file permissions)
XYZ: is the permission attribute of the number type just mentioned, which is the sum of the numeric values of the Rwx property.
-R: Continuous improvement of recursion, that is, all files under subdirectories will change.
Example: Chmod-r 777 Testfile
Modify the directory Testfile and all the users in the directory have full permissions.
Syntax: chmod U + (join) R
G-(remove) W file or directory
o = (set) x
A
Example: chmod g+w testfile
Gives the file testfile the group write permission.
2.chown
Function: Change file or directory owner
Syntax: chown [User: User group] [file or directory]
Example: Chown root:root Install.log
3.chgrp
Function: Change the owning group of a file or directory
Syntax: chgrp [user Group] [file or directory]
Example: Chgrp users Install.log
4.gzip
Features: Only files can be compressed and directories cannot be compressed. After compressing only the compressed package, the source file is missing and the source file is not preserved.
Syntax: gzip [-cdtv#] file name. gz
-C: The compressed data is sent to the screen, can be processed by data stream redirection;
-D: the extracted parameters;
-T: can be used to verify the consistency of a compressed file, to see whether the file error;
-V: can display the original file/compressed file compression ratio and other information;
-#: Compression level, 1 the fastest, but the compression ratio is the worst,-9 slowest, but the compression ratio is best by default-6.
Example: Gzip-v man.config
5.tar
Function: Package directory. All users have Execute permissions. Format after compression: tar.gz
Syntax: tar option [-zcf][compressed file name] [directory]
TAR-C: Packing
TAR-V: Show more information
Tar-f: Specify file name
Tar-z: Packing and compressing at the same time
Example: Tar-zpcv-f/root/etc.tar.gz/etc
The tar Command decompression command:
Tar-x: Unpacking the Package
TAR-V: Show more information
Tar-f: Specify Unzip file
Tar-z: Decompression
Example: TAR-ZXVF japan.tar.gz
6.zip
Features: Compress files or directories. Compressed format:. zip. Compressed files and original files after compression.
Syntax: Zip option [-r] [compressed post file name] [file or directory]
Example:
7.unzip
Function: Unzip compressed file of. zip
Syntax: Unzip [compressed file]
Example: Unzip Test.zip
8.bzip2
function: To replace gzip, provide a better compression ratio.
Syntax: bzip [-cdkzv#] File name
-C: The data in the compression process is output to the screen;
-D: the extracted parameters;
-K: retains the original file without deleting the original file;
-Z: Compressed parameters
-V: can show the source file/compressed file compression ratio and other information
-#: Same as gzip, all in the calculation of compression ratio parameters,-9 best,-1 fastest.
Example: Compressing/tmp/man.config with bzip2
Bzip2-z Man.config
9.bzcat
Function: Unzip the specified. bz2 file and display the extracted file contents. The original compressed file is preserved and the extracted files are not generated.
Syntax: bzcat [. bz2 Compressed file: Specifies the. bz2 compressed file to display content. ]
Example: Compress/tmp/man.config in bzip format:
Bzip2-z Man.config
10.compress
[[email protected] ~]# compress [-DCR] file or directory
Parameters:
-D: Parameters to decompress
-R: can also be compressed together with the files in the directory!
-C: Output compressed data to standard output (outputs to screen)
Example:
Example one:/etc/man.config is copied to/TMP and compressed
[Email protected] ~]# cd/tmp
[Email protected] tmp]# cp/etc/man.config.
[Email protected] tmp]# compress man.config
[Email protected] tmp]# ls-l
-rw-r--r--1 root root 2605 Jul 11:43man.config.z
Example two: Unlock the zip file you just got
[Email protected] tmp]# compress-d man.config.z
Example three: compressing the man.config into another file to back up
[Email protected] tmp]# compress-c man.config >man.config.back.z
[email protected] tmp]# ll man.config*
-rw-r--r--1 root root 4506 Jul 11:43man.config
-rw-r--r--1 root root 2605 Jul 11:46man.config.back.z
# The parameters of this-C are more interesting! He will output the data from the compression process to the screen instead of writing it into
# file. Z file. Therefore, we can export the data to another file name through a data flow redirection method.
# for Data flow redirection, we'll talk more about it in bash shell!
This article is from "For Tomorrow" blog, please be sure to keep this source http://andyboge.blog.51cto.com/6809119/1748474
Linux Basic Instruction III