Linux文件传输


#########不同系统间的文件传输##############

tar 打包

tar -c ##新建打包文件

tar -t ##查看打包的内容,重点在查看文件名

tar -x ##解打包,解压缩

tar -j ##bzip2压缩解压缩

tar -z ##gzip压缩解压缩

tar -v ##在压缩、解压缩的过程中,将正在处理的文件名列出来()

tar -r ##添加文件到包中

tar -f ##指定生成包的名字

tar -C ##解压缩时候指定特定目录

tar -p ##保留备份

tar -P ##保留绝对路径

tar --delete filename ##删除包中指定文件

tar --get filename     ##取出包中指定文件

注:-c -t -x 不能出现在一串命令行中

<span style="font-family:SimSun;font-size:18px;">[liu@localhost Desktop]$ touch file{1..5}

[liu@localhost Desktop]$ tar -cf file.tar file{1..5}
</span>
[liu@localhost Desktop]$ tar -xf file.tar

#############压缩###################

gzip

gzip x.tar =====>x.tar.gz ##压缩

gunzip x.tar.gz =====> x.tar ##解压

tar zcvf x.tar.gz 目标文件 ##打包压缩文件

tar zxvf x.tar.gz  ##x.tar.gz===>x

bz2

bzip2 x.tar =====>x.tar.bz2 ##压缩

bunzip2 x.tar.bz2 =====> x.tar ##解压

tar jcvf x.tar.bz2 目标文件  ##打包压缩文件

tar jxvf x.tar.bz2 ##x.tar.bz2===>x

xz

xz x.tar =====> x.tar.xz    ##压缩

unxz x.tar.xz =====> x.tar   ##解压

tar Jcvf x.tar.xz  目标文件 ##打包压缩文件

tar Jxvf x.tar.xz         ##x.tar.xz===>x

zip

zip -r x.tar.zip x.tar    ###压缩

unzip x.tar.zip         ###解压

[liu@localhost Desktop]$ touch file{1..8}
[liu@localhost Desktop]$ tar zcvf file.tar.gz file{1..8}

[liu@localhost Desktop]$ rm -fr file{1..8}
[liu@localhost Desktop]$ tar zxvf file.tar.gz

##########scp###############

scp ##远程复制

scp  文件名 用户名@ip:/路径    ##上传文件

scp -r  路径 用户名@ip:/路径   ##长传目录

scp  用户名@ip:/文件名 /路径  ##下载文件

scp -r 用户名@ip:/路径/路径   ##下载目录

[liu@localhost Desktop]$ scp file5 root@192.168.1.125:/home/liu

##########rsync################

rsync ##远程同步

rsync file|目录路径 user@ip:/路径

rsync user@ip:/目录路径 /路径

rsync -r##同步目录

rsync -l##不忽略链接

rsync -o##保持文件属主信息

rsync -t##不忽略时间戳

rsync -p##不忽略权限

rsync -o##不忽略用户信息

rsync -D##不忽略设备文件

rsync -g##不忽略组信息

[liu@localhost Desktop]$ rsync file5 root@192.168.1.125:/home/liu

#########sftp###############

sftp ##安全文件传输命令

sftp user@ip

pwd ##看远端服务器的目录

lpwd##本地目录

help##查看都sftp支持哪些命令

ls   ##看远端服务器的目下的东西

lls  ##本地目录的东西

exit quit##退出

#########End###############


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值