Linux Common command Daquan---file backup and compression commands

Source: Internet
Author: User
Tags bz2

In Linux, the commonly used file compression tools are gzip, bzip2, zip. BZIP2 is the ideal compression tool that provides maximum compression. Zip compatibility good windows also supports

1.BZIP2 command

At the shell prompt, enter the command: Zip file:bzip2 filename    //file will be compressed and saved as filename.bz2 extract file:bunzip2 filename.bz2   //filename.bz2 will be deleted, and filename instead of bzip2  filename.bz2  file1  file2  file3/usr/work/school      //compress the contents of the File1, File2, File3, and/usr/work/school directories and put them in filename.bz2

2.gzip command (same as zip command)

command in Shell prompt: Zip file:gzip filename     //file will be compressed and saved as filename.gz extract file:gunzip filename.gz    // Filename.gz will be deleted, and the filename instead of gzip-r filename.gz file1 file2 file3/usr/work/school      //above command file1, File2, The contents of the File3 and/usr/work/school directories are compressed into filename.gz.

The 3.tar command was originally used for tape backup, but because of the larger size of the hard disk, now the main use of this command to back up all the files

Tar this command packs a large number of files and directories into a file-C to create a new archive-F when used with the-c option, the tar file that is created uses the file name specified by this option, and when used with the-X option, the archive-t specified by this option is released to display the list of files included in the tar file -V Show file Progress-X Extract files from archive-Z use gzip to compress tar files-j use bzip2 to compress tar files to create a tar file:TAR-CVF Filename.tar directory/file/home/mineThe above command puts Directory/file,/home/mine into the archive file to list the contents of the tar file:TAR-TVF Filename.tarTo extract the tar file command, enter the command:TAR-XVF Filename.tarThis command does not delete the tar file, but it copies the contents of the archive to the current directory and preserves any directory structure used by the archive file. Keep in mind that tar does not compress files by default.

To create a file that uses tar and bzip2 to archive compressed files, use the-J option:tar-cjvf filename.tbz FileIf you use the BUNZIP2 command to extract the Filename.tbz file, the FILENAME.TBZ is deleted and replaced with Filename.tar. To extend and de-archive the Bzip.tar file, enter the command:TAR-XJVF filename.tbzTo create a file that is archived and compressed in tar and gzip, use the-Z option:tar-czvf filename.tgz FileIf you use the Gunzip command to extract the Filename.tgz file, filename.tgz will be deleted to Filename.tar instead

Linux Common command Daquan---file backup and compression commands

Related Article

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.