Fork me on GitHub

Linux下命令lrzsz

 

lrzsz是什么

在使用Linux的过程中,难免少不了需要上传下载文件,比如往服务器上传一些war包之类的,之前都是使用winSCP,lrzsz是一个更方便的命令,可以直接在Linux中输入命令,弹出一个框来选择上传的文件或者下载的文件保存的位置,然后确定就OK了。lrzsz并不是内置命令,默认情况下大多数Linux版本都没有这个命令,需要自己安装才可以使用。

 

如何安装

在官网下载lrzsz的最新发行版本:https://ohse.de/uwe/software/lrzsz.html

下载安装包:

wget https://ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz

解压:

tar zxvf lrzsz-0.12.20.tar.gz

进入解压后的目录,make一下:

./configure && make && make install

如果make过程中出现如下错误:

no acceptable cc found in $PATH

需要先安装gcc:

yum install gcc

进入/usr/bin目录,为之前安装的文件创建软链接:

ln -s /usr/local/bin/lrz rz
ln -s /usr/local/bin/lsz sz

 

 

如何使用

rz : 上传

sz <file-name> : 下载

 

X-shell会弹出窗口让选择

SecureCRT在Options -> session options -> X/Y/Zmodem设置默认的路径

 

上传文件技巧

X-Shell可以直接把一个或多个文件拖动到X-Shell界面上,即会自动将被拖动的文件上传到命令行当前目录下。

 

参考文档

输入 rz -h 或者 sz -h可 以查看帮助文档:

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

short options use the same arguments as the long ones

 

 

参考文档:

1. https://ohse.de/uwe/software/lrzsz.html

 

posted @ 2017-08-19 03:47  CC11001100  阅读(2084)  评论(0编辑  收藏  举报