Linux compression commands

Source: Internet
Author: User



Tar

Syntax: Tar options [-ZCF] [file name after compression] [directory]

Package all files in the entire/home/jxn/familya directory into/home/jxn/familya.tar

Package only, do not compress Tar-cf/home/jxn/familya.tar/home/jxn/familya

After packaging, compress Tar-zcf/home/jxn/familya.tar.gz/home/jxn/familya with gzip

After packaging, compress Tar-jcf/home/jxn/familya.tar.bz2/home/jxn/familya with bzip2

View content in a compressed file
TAR-TF familyA.tar.gz
Tar-tzf familyA.tar.gz
TAR-TJF familyA.tar.gz

Decompression Family.tar TAR-XF Familya.tar

Unzip familyA.tar.gz tar-xf familyA.tar.gz or TAR-ZXF familyA.tar.gz

Unzip familyA.tar.bz2 tar-xf familyA.tar.bz2 or TAR-JXF familyA.tar.bz2

# Special Note that the file name after the parameter F is taken by itself, we used to use the. Tar as an identification
# if the z parameter is added, the. tar.gz or. tgz represent the gzip compressed tar file
# If you add the J parameter, use. tar.bz2 as the document name

-C Create a new package file

-v Verbose show command execution in verbose mode

-F file indicates files that need to be packaged

-T view the contents of the compressed file

-X Extract (extract) unpack *.tar file

-Z Packaging simultaneous with gzip compression (with-X coexistence, means decompression xxx.tar.gz)

-J packaging with bzip2 compression (with-X co-exist, means decompression xxx.tar.bzip2)

-TF viewing files inside a packaged file


--------------------------------------------------------------------------------------------------------------- -----------
Zip

Zip option [-r] [filename after compression] [file or directory]
#压缩文件或目录,-R compression Directory

Unzip

Unzip Xxx.zip
Compressed files #解压. zip

--------------------------------------------------------------------------------------------------------------- -----------
Gzip (GNU Zip)


Compress all files in/home/jxn directory under Familya directory into. gz files

 cd/home/jxn The

 tar-cvf/home/jxn/familya.tar/home/jxn/familya is packaged first because Gzip cannot compress the directory directly
 gzip Familya.tar Compress

 gzip-l familyA.tar.gz View compressed package details

  #递归地压缩目录familyC中的所有文件
 # Note: Only all files in the FAMILYC directory and the files in the FAMILYC subdirectory are compressed and deleted, but the FAMILYC directory and subdirectories of the FAMILYC directory are not compressed
 gzip-r familyc
 
Decompression:
 gzip-dv familyA.tar.gz


-C exports the result to standard output and retains it to the original file; Because option C outputs the compression result to standard output, you need to use redirection to save the compression result

-D decompress (unzip) extract file

-l Display details of a compressed file

-R recursively compresses all files in the directory, compressing only the files in the directory and its subdirectories, and the directory itself does not compress

-0→9: Represents the compression rate, 1 is the minimum compression rate, and the fastest compression  gzip-c9 Test.tar > test.tar.gz

gunzip (GNU unzip)

Gunzip xxx.gz
#解压. gz Compressed file

--------------------------------------------------------------------------------------------------------------- ---------------------------------------
Bzip2

Compress all files in the Familya directory under the/home/jxn directory into. bz2 files
Cd/home/jxn
Tar-cvf/home/jxn/familya.tar/home/jxn/familya
Bzip2 Familya.tar

Decompression familyA.tar.bz2
Bzip2-d familyA.tar.bz2


-K Save the original file after the compression and decompression is complete

-D Decompress (unzip) unzip the file

Bunzip2

BUNZIP2 option [-K] [compressed file]
#解压缩. bz2 compressed file,-K to retain the original file after decompression

--------------------------------------------------------------------------------------------------------------- --------------------------------
RPM Installation

Package Full Name: The package full name is used when the operating package is not installed. and pay attention to the path
Package Name: Use the package name when you operate a package that has already been installed (such as uninstall). is to search the database in/var/lib/rpm/

RPM Package Full Name
Options:
-I (Install) installation
-V (verbose) Show details
-H (hash) Show progress
-Q Queries whether the package is installed
-P (Package) query does not install packages information
-A (All) usage: Rpm-qa query all installed RPM packages
-E (Erase) Uninstall
-U (update) upgrade
-L (list) lists
-R (requires) query package dependencies
--nodeps does not detect dependencies

#查询包是否安装
RPM-Q Package Name
Rpm-qa

RPM Offload
RPM-E Package Name
Options:
-E (Erase) Uninstall
--nodeps does not check for dependencies

Currently download the mainstream Linux system version is basically integrated MySQL database inside, so before installing MySQL check whether the system has MySQL

#查看该操作系统上是否已经安装了mysql数据库
Rpm-qa | grep MySQL

--------------------------------------------------------------------------------------------------------------- --------------------------------
APT Package management


sudo apt-get install PackageName
#安装软件包


sudo apt-get remove PackageName


#删除软件包

sudo apt-get update

#
Get a list of new packages


sudo apt-get upgrade


#升级有可用更新的系统


Apt-get Help

#列出更多命令和选项





Linux compression commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.