004day--linux command tar soft and hard links

Source: Internet
Author: User
Tags bz2 unpack

First, the tar command introduction:

-C: Create a new tar file

-T: List contents of a directory in a tar file

-X: Extracting files from the tar file

-F: Specifies the archive or tape (or possibly floppy) device (usually selected)

-V: Displays the details of the packaged file, V is the 1th letter of the verbose

-Z: Compress the packaged files using the gzip compression algorithm

-J: Compressing a packaged file using the BZIP2 compression algorithm

tar cf test.tar a.txt b.txt c.txt #把这三个文件归档为test. Tar

TAR-TF Test.tar #查看归档文件

Tar xf Test.tar #解包

tar xvf/test/test.tar-c/bak #指定目录解包

tar cvzf test.tar.gz a.txt b.txt c.txt #打包压缩

gzip a.txt #压缩gunzip a.txt.gz #解压

Cat command:cat a.txt b.txt c.txt >mu #将这三个文件纵向合并为mu文件

After-school assignments (spents 65 minutes)

1) Merge user information database files and group information database files vertically into one file/1.txt (overwrite)

CD/

cat/home/*/etc/group/* > 1.txt

2) Merge user information database files and user password database files vertically into one file/2.txt (append)

cat/home/*/etc/group/* >> 2.txt

3) Package The/1.txt,/2.txt two files as a/1.tar

Tar CF 1.tar 1.txt 2.txt

4) Use the gzip command to compress the 1.txt file named 1.txt.gz

Gzip 1.txt

5) Decompression 1.txt.gz

Gunzip 1.txt.gz

6) file name 1.txt.bz2 after compressing 1.txt compression with bzip2

Bzip2 1.txt

7) Decompression 1.txt.bz2

BUNZIP2 1.txt.bz2

8) Unpack 1.tar, unpack the file and store it in the/tmp directory

Tar xvf 1.tar-c/tmp

9) Use the TAR command to package and compress/1.txt,/2.txt, and get the file name 1.tar.gz

Tar cvzf 1.tar.gz 1.txt 2.txt

10) Unpack the 1.tar.gz, unpack the file and store it in the/tmp directory

Gunzip 1.tar.gz

Tar xvf 1.tar-c/tmp

Second, soft and hard links

Soft Links:ln-s/source/a.txt/dst/aa.txt #可在不同盘符之间创建链接

Hard Links:ln/source/a.txt/source/aa.txt #只可在本地下创建

004day--linux command tar soft and hard links

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.