Linux (Radhat) Basic Learning-File transfer

Source: Internet
Author: User
Tags bz2 rsync

1.SCP Transmission

SCP: Remote replication transfer, very slow

目录上传:    scp -r 目录 用户名@主机ip:绝对路径文件上传    scp   文件   用户名@主机ip:绝对路径 远程下载:    scp  -r   用户@主机ip:绝对路径  下载目录
2.rsync Transmission

Rsync: Image transmission transmission, remote synchronization, fast, default ignore file attributes, connection files, device files, but can add parameters to the ignored files are also synchronized transmission

下载: rsync [选项] 远程主机用户@ip:绝对路径 下载位置上传: rsync [选项] 本地文件位置 远程主机用户@ip:绝对路径                -r   同步目录                -p  同步权限                -o  同步文件所有者                -g  同步文件所有组                -D   同步设备文件                -l   同步链接                -t   同步时间戳
Attention:

Whether it is an SCP or an rsync transfer file, when the file being transferred is a directory of multiple files (or subdirectories):

a.目录后加“/“表示不传输这个目录,只传输目录下的内容,如:rsync /mnt/test/ [email protected]:/mnt(这将test目录下的内容传输给了172.25.254.77)b.目录后不加“/“表示连同这个这个目录一起传输,,如:rsync /mnt/test [email protected]:/mnt(这连带test目录传输给了172.25.254.77)
3. File archiving

Archive: Package many files into one file. Archiving does not compress files.

tar [选项] 文件        -c  创建        -v  显示过程        -f  指定归档文件名字        -tf 显示归档文件内的内容        -rf 添加文件到归档文件中        -xf 解档所有文件        -C  解档文件到指定目录(放在命令最后)

--get file specified
--delete deleting files specified in the archive

tar -cf 归档文件名 需要归档文件/目录...(多个文件/目录用空格隔开)tar -cf newfilename file1 file2 dir 归档file1,file2,目录dir到newfilenametar -rf newfilename xxx         添加xxx到归档文件tar中tar -f newfilename --get xxx        从归档文件newfilename中解档xxx
4. Compression
1.zip    zip -r xxx.tar.zip xxx.tar    unzip xxx.tar.zip2.gz    gzip xxx.tar    gunzip xxx.tar.gz    ===========    tar -zcf xxx.tar.gz /xxx    tar -zxf xxx.tar.gz3.bz2    bz2 xxx.tar    bunzip2 xxx.tar.bz2    ===========    tar jcf xxx.tar.bz2 /xxx    tar jxf xxx.tar.bz24.xz    xz xxx.tar    unxz xxx.tar.xz    ===========    tar Jcf xxx.tar.xz /xxx    tar Jxf xxx.tar.xzzip无法一步完成打包和压缩,只能先单独归档,再压缩。其他3个可以一步完成

Linux (Radhat) Basic Learning-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.