Tar command basic usage (encryption)

Source: Internet
Author: User
Tags gz file

This article describes the basic use of the tar command, Special: Use the tar command to encrypt the file.
Assume that there is a folder/stuff in the current directory.
1. Pack all the files in the/stuffdirectory into A. tar file.
$ Tar-CVF stuff.tar stuff
Will get a stuff.tar File
2. Pack all the files in the/stuffdirectory into a tar.gz file (BTW: tgz = tar.gz)
$ Tar-CZF stuff.tar.gz stuff
Will get to a stuff.tar.gz File
3. view all files under the tar file (like ls)
$ Tar-tzf stuff.tar.gz
Or
$ Tar-TF stuff.tar

4. decompress the tar | tar.gz file
A> Use redirection to direct the contents of the TAR to the mout file
$ tar-tzf stuff.tar.gz> mout
B> edit the mout File, retain the content you want to decompress
C> decompress tar according to the mout file
$ tar-T mout-xzf stuff.tar.gz
of course, You can decompress it all
$ tar -xzf stuff.tar.gz
5. use tar to encrypt files
$ tar-zcvf-stuff | OpenSSL des3-salt-K secretpassword | dd OF = stuff. des3
Returns a stuff. des3 file: replace secretpassword with your password. Do not forget to
decompress the encrypted file using tar
$ dd If = stuf F. des3 | OpenSSL des3-D-K secretpassword | tar zxf-
note that the last "-" command releases all files.

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.