Linux Learning Notes-packaging, compression, remote file transfer

Source: Internet
Author: User
Tags bz2 scp file rsync

########### #打包, Compression ##########################

1. Packaging (packaging means to turn a bunch of files into one)
Tar # #打包工具
-F # #指定生成包的名字
-C # #创建包
-V # #显示创建过程
-T # #查看包中内容
-X # #解包
-R # #追加文件到包中
-C # #指定目录
--delete FileName # #删除包中指定文件
--get FileName # #取出包中指定文件
eg
TAR-CF test.tar/etc/# #生成包 (ll-lh view size, Unit m)
TAR-CVF Test.tar # #生成包, you can see the process
TAR-XF Test.tar # #解包到当前
TAR-XVF Test.tar # #解包到当前, you can see the process
TAR-XF test.tar-c/mnt/# #解包到/mnt/Directory
TAR-TF Test.tar # #查看包中内容
TAR-RF Test.tar File # #追加file文件到test. tar
Tar-f test.tar--get File # #取出包中指定的file文件

2. Compression (a mechanism for compressing the size of a computer file by a specific algorithm)
1) gzip
Gzip Test.tar # #压缩test. tar===>test.tar.gz format
Gunzip test.tar.gz # #解压test. Tar.gz===>test.tar
gzip-d Zip package name # #解压
Step: TAR-CF test.tar/etc/# #先要生成包
Gzip Test.tar # #gzip再压缩
One-step operation: TAR-ZCVF test.tar.gz/etc/# #一次性打包压缩文件

TAR-ZXVF test.tar.gz # # #解压test. tar.gz===>test

2) bz2
bzip2 Test.tar # #压缩test. Tar =====> test.tar.bz2 format
BUNZIP2 test.tar.bz2 # #解压test. tar.bz2 =====> Test.tar
Tar jcvf test.tar.bz2 target file # #一步打包压缩文件
Tar jxvf test.tar.bz2 # #解压test. tar.bz2===>test

3) XZ
XZ Test.tar # #压缩test. Tar =====> test.tar.xz format
Unxz test.tar.xz # #解压test. Tar.xz =====> Test.tar
Tar jcvf test.tar.xz target file # #一步打包压缩文件
Tar jxvf test.tar.xz # #解压test. tar.xz===>test

4) Zip (both Windows and Linux support the format, zip compression will keep the source file)
Zip-r test.tar.zip Test.tar # # #对test. Tar compression (compressed directory to add-R, otherwise the compression ratio is 0%)
Unzip Test.tar.zip # # #解压
eg
Zip test.zip/etc/# #压缩/etc/
Zip test.tar.zip Test.tar # #压缩test. tar===>test.tar.zip format
Format: Zip compressed file source file

Note: Tar is packaged first, and files compressed with zip are smaller than files that compress the directory directly

##################### #远程文件传输 #####################
SCP # #远程复制 (is a new process)
SCP file [email protected]:/directory # #上传文件
Scp-r dir [email protected]:/directory # #上传目录
SCP [email Protected]:/filename/direcotry # #下载文件
scp-r [email protected]:/directory/direcotry # #下载目录

eg
Scp-r test/[Email protected]:/root/desktop
# #把test目录远程传输到 [Email protected]:/root/desktop
scp-r [Email Protected]:/root/desktop/test1/home/westos/desktop
# #把 [email protected]:/root/desktop/test1 file to local desktop

Rsync # #远程同步 (rsync will pack and sync faster than SCP)
rsync file|direcotry [Email protected]:/directory
rsync [Email protected]:/directory (is target)/directory
-R # #同步目录
-L # #不忽略链接
-P # #不忽略权限 (attributes are exactly the same)
-T # #不忽略时间戳
-G # #不忽略组信息
-O # #不忽略用户信息
-D # #不忽略设备文件

This article is from the "12148275" blog, please be sure to keep this source http://12158275.blog.51cto.com/12148275/1898601

Linux Learning Notes-packaging, compression, remote file transfer

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.