Linux文件在系统中方的传输

一、文件的传输

搭建实验环境

1、在/mnt下建立几个文件

2、改变用户及生产组

3、改变文件权限

4、给westos1建立快捷方式file

1、scp

发送:scp /mnt/wedtos*  [email protected]:/mnt

接受:ll

2、rsync         ##远程同步 优点:速度快 缺点:会忽略:文件属性,连接文件、设备文件

    -r:   ##同步目录

接收

-p     ##同步权限

接受

-o       ##同步文件所有人

接收

-g       ##同步文件所有组

接收

-l         ##同步连接

接收

-t       ##同步文件时间

接收

2、块设备

-D       ##同步设备文件

接收

二、文件的归档

1、tar 

tar -cf etc.tar file           ##创建一个打包文件etc.tar文件           -f                  ##文件内容


  -r                  ##添加打包文件


  -t                  ##查看打包文件   tar tf eth.tar


tar  -x etc.tar       ##解压文件
   -C                 ##解压指定目录    tar -xf etc.tar -C /mnt
  --get               ##只解压指定文件  tar -f etc.tar  --get file


 --delete             ##删除指定文件    tar -f etc.tar --delete file

三、文件压缩

1zip       ###压缩文件
zip -r etc.tar.zip etc.tar      ##压缩etc.tar为压缩文件etc.tar.zip


du -sh etc.tar                  ##查看文件大小


unzip etc.tar.zip               ##解压文件

1)gzip   etc.tar                  ##


gunzip etc.tar.gz               ##解压


2)bzip2  etc.tar


bunzip etc.tar.ba2              ##解压


3)xz     etc.tar        


unxz   etc.tar.xz               ##解压

2、文件归档+压缩

1)gzi :tar zcf etc.tar.gz   /etc     

tar zxf etc.tar.gz



2)bzip2:tar jcf etc.tar.bz2  /etc

tar jxf etc.tar.bz2



3)xz:tar Jcf etc.tar.xz   /etc

tar Jxf etc.tar.xz

猜你喜欢

转载自blog.csdn.net/wanghu66/article/details/83054439