linux command compression and compression platform to build rental Australia 5 lucky to extract the files

The Linux tar command is usually used to create .tar.gz or .tgz archives. Australia 5 lucky buns source platform to build [Forum wowotoubbs.com] Q: 2171793408, Tel: 17061863521 This command has many options, but you only need to remember a few letters can be used to quickly create a tar archive. tar command can also extract files generated.

   

Compress an entire directory or individual files

Use the following command to compress an entire directory or individual files on Linux. It will also compress the directory you specify a directory for each other - in other words, it works recursively.

tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

The following is the actual meaning of these switches:

-c: C create an archive.
-z: Use gz ip compressed archive.
-v: show progress when you create an archive of the terminal, also known as "v erbose" mode. In these commands, v is always optional, but it is useful.
-f: Allows you to specify ˚F archive ilename.

If the current directory has a "data" directory called, and you want to save it to a file named archive.tar.gz, you can run the following command:

tar -czvf archive.tar.gz data

If you have / usr / local / something directory on the current system, and you want to compress the file named archive.tar.gz, you can run the following command:

tar -czvf archive.tar.gz /usr/local/something

Extracting archives

After the archives, you can use the tar command to extract it. The following command to extract the contents of the current directory archive.tar.gz.

tar -xzvf archive.tar.gz

It creates the same archive command we used above, except replace the -x switch -c switch. This specifies that you want to extract the archive instead of creating an archive.

You may want to extract the contents of an archive to a specific directory. You do this can be appended to the end of the command by -C switch. For example, the following command archive.tar.gz contents of the file are extracted to the / tmp directory.

Guess you like

Origin www.cnblogs.com/yuwenqingtian/p/10966299.html