Linux 文件在系统中的传输

1.scp

        scp file user@ip:/dir
        scp user@ip:/file dir


2.rsync  ##远程同步,速度快,默认会忽略,文件属性,连接文件,设备文件

     -r  ##同步目录
    -p  同步权限
    -o  同步文件所有人
    -g  同步文件所有组
    -l  同步链接
    -D  同步设备文件
    -t  同步文件时间戳

                                        将 /root/Desktop/westos同步到 /mnt/

 

 

                                            westos目录中的file1-6权限

                                               权限已经同步过去

 

                          将文件所有人,文件所有组都改为student

                       同步文件所有人,同步文件所有组为student

 

 

 


3.tar ##归档文件,(把很多个文件变成一个文件)

 c  ##创建
 v  ##显示过程
 t  ##查看归档文件内容
 f  ##指定归档文件名称
 r  ##添加文件到归当中
-C ##指定目录
--get westos ##解档指定文件
--delete ##删除归档中的指定文件
rf 归档进去


tar cf etc.tar /etc/  将etc归档到etc.tar
tar rf etc.tar westos 将westos归档到etc.tar
tar -f etc.tar --get etc  解档etc
tar xf etc.tar  全部解档
tar -f etc.tar --delete westos  删除归档中的westos
tar xf etc.tar -C /mnt/    解档到指定地方
tar cf /mnt/etc.tar /etc/  归档到指定地方

 

示例:

tar cf etc.tar /etc/  将etc归档到etc.tar

tar rf etc.tar westos 将westos归档到etc.tar

tar -f etc.tar --get etc  解档etc

tar xf etc.tar  全部解档

 

4.压缩

    zip
    zip -r xxx.tar.zip xxx.tar


    unzip    xxx.tar.zip


归档压缩一部完成:  

     1. gz

   gzip xxx.tar
    gunzip xxx.tar.gz  ##解压
    tar zcvf etc.gz /etc/  ##归档压缩一部完成:
    tar zxf etc.gz


   2.bz2

    bzip2 xxx.tar
    bunzip2 xxx.tar.bz
    tar zcvf etc.bz2 /etc/  ##归档压缩一部完成:


    tar zxf etc.bz2


   3.xz

        xz xxx.tar
        unxz xxx.tar
    tar Jcvf etc.tar.xz /etc/


     tar Jxf etc.tar.xz

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值