linux安装xshh上传文件,通过Xshell上传文件

在对服务器进行维护的时候,我们经常需要进行传文件,这里介绍一个WINDOWS与LINUX进行文件互传的方法——使用lrzsz传输

实现说明:lrzsz不适合传输大文件,只适合传输代码级别的小文件

Windows端已经安装Xshell,通过Xshell使用ssh登陆远端的Linux服务器,首先查看是否已经安装lrzsz

#输入

rpm -qa lrzsz

无输出表示未安装,接下来输入命令安装:

#Ubuntu系列

sudo apt-get install lrzsz

#Centos系列

sudo yum -y install lrzsz

#注:-y表示默认Yes,可以去掉-y

1.上传文件(Windows到Linux)

之后输入rz –help查看命令提示

[root@VM_0_7_centos html]# rz --help

rz version 0.12.20

Usage: rz [options] [filename.if.xmodem]

Receive files with ZMODEM/YMODEM/XMODEM protocol

(X) = option applies to XMODEM only

(Y) = option applies to YMODEM only

(Z) = option applies to ZMODEM only

-+, --append append to existing files

-a, --ascii ASCII transfer (change CR/LF to LF)

-b, --binary binary transfer

-B, --bufsize N buffer N bytes (N==auto: buffer whole file)

-c, --with-crc Use 16 bit CRC (X)

-C, --allow-remote-commands allow execution of remote commands (Z)

-D, --null write all received data to /dev/null

--delay-startup N sleep N seconds before doing anything

-e, --escape Escape control characters (Z)

-E, --rename rename any files already existing

--errors N generate CRC error every N bytes (debugging)

-h, --help Help, print this usage message

-m, --min-bps N stop transmission if BPS below N

-M, --min-bps-time N for at least N seconds (default: 120)

-O, --disable-timeouts disable timeout code, wait forever for data

--o-sync open output file(s) in synchronous write mode

-p, --protect protect existing files

-q, --quiet quiet, no progress reports

-r, --resume try to resume interrupted file transfer (Z)

-R, --restricted restricted, more secure mode

-s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds

-S, --timesync request remote time (twice: set local time)

--syslog[=off] turn syslog on or off, if possible

-t, --timeout N set timeout to N tenths of a second

-u, --keep-uppercase keep upper case filenames

-U, --unrestrict disable restricted mode (if allowed to)

-v, --verbose be verbose, provide debugging information

-w, --windowsize N Window is N bytes (Z)

-X --xmodem use XMODEM protocol

-y, --overwrite Yes, clobber existing file if any

--ymodem use YMODEM protocol

-Z, --zmodem use ZMODEM protocol

直接输入命令:rz即可从Windows上传文件到Linux中

rz

#或者需要覆盖的话rz -y

2.下载文件(Linux到Windows)

输入 sz 即可直接从Linux下载文件下来,注意直接输入文件名是当前路径,也可以输入绝对路径进行传输

sz

输入sz –help查看命令细则

[root@VM_0_7_centos code]# sz --help

sz version 0.12.20

Usage: sz [options] file ...

or: sz [options] -{c|i} COMMAND

Send file(s) with ZMODEM/YMODEM/XMODEM protocol

(X) = option applies to XMODEM only

(Y) = option applies to YMODEM only

(Z) = option applies to ZMODEM only

-+, --append append to existing destination file (Z)

-2, --twostop use 2 stop bits

-4, --try-4k go up to 4K blocksize

--start-4k start with 4K blocksize (doesn't try 8)

-8, --try-8k go up to 8K blocksize

--start-8k start with 8K blocksize

-a, --ascii ASCII transfer (change CR/LF to LF)

-b, --binary binary transfer

-B, --bufsize N buffer N bytes (N==auto: buffer whole file)

-c, --command COMMAND execute remote command COMMAND (Z)

-C, --command-tries N try N times to execute a command (Z)

-d, --dot-to-slash change '.' to '/' in pathnames (Y/Z)

--delay-startup N sleep N seconds before doing anything

-e, --escape escape all control characters (Z)

-E, --rename force receiver to rename files it already has

-f, --full-path send full pathname (Y/Z)

-i, --immediate-command CMD send remote CMD, return immediately (Z)

-h, --help print this usage message

-k, --1k send 1024 byte packets (X)

-L, --packetlen N limit subpacket length to N bytes (Z)

-l, --framelen N limit frame length to N bytes (l>=L) (Z)

-m, --min-bps N stop transmission if BPS below N

-M, --min-bps-time N for at least N seconds (default: 120)

-n, --newer send file if source newer (Z)

-N, --newer-or-longer send file if source newer or longer (Z)

-o, --16-bit-crc use 16 bit CRC instead of 32 bit CRC (Z)

-O, --disable-timeouts disable timeout code, wait forever

-p, --protect protect existing destination file (Z)

-r, --resume resume interrupted file transfer (Z)

-R, --restricted restricted, more secure mode

-q, --quiet quiet (no progress reports)

-s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds

--tcp build a TCP connection to transmit files

--tcp-server open socket, wait for connection

-u, --unlink unlink file after transmission

-U, --unrestrict turn off restricted mode (if allowed to)

-v, --verbose be verbose, provide debugging information

-w, --windowsize N Window is N bytes (Z)

-X, --xmodem use XMODEM protocol

-y, --overwrite overwrite existing files

-Y, --overwrite-or-skip overwrite existing files, else skip

--ymodem use YMODEM protocol

-Z, --zmodem use ZMODEM protocol

可以看得出有非常多的格式功能说明这个软件还是很强大的。

Post Views:

1,165

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值