折腾:
【未解决】Mac中用SecureCRT无法用rz上传文件到CentOS服务器
期间,去试试iTerm2中rz上传文件的支持
希望实现:和SecureCRT一样的,rz回车后,弹框选择文件后,就自动开始上传了。
不用出现特殊的指令之类的。
SecureCRT upload, download the file (using the SZ RZ command)
laggardkernel/iterm2-zmodem: Installing Z-Modem integration for iTerm2 with Homebrew
iterm2 rz
mac iterm2 lrzsz
Mac osx 下安装iTerm2,并使用rz sz上传下载(附homebrew配置) – 个人文章 – SegmentFault 思否
此处mac中已有rz
➜ ~ which rz /usr/local/bin/rz ➜ ~ 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
short options use the same arguments as the long ones
➜ ~ which rz
/usr/local/bin/rz
➜ ~ rz –version
rz (lrzsz) 0.12.20
不知道和,ssh登录后远程服务器中运行的rz,不会有冲突吧
应该不会
[root@lin-16core3 ~]# which rz /usr/bin/rz [root@lin-16core3 ~]# rz --version rz (lrzsz) 0.12.20
本地和CentOS中,都有rz的。不会冲突
iTerm2 使用 lrzsz 的 rz sz 上传下载命令 – 个人文章 – SegmentFault 思否
看来是要去配置的,不过配置后,就可实现上传文件了。
解决在Mac下iTerm2终端使用sz和rz命令报错问题 | 沈唁志
OSX下iTerm2实现rz/sz与服务器进行文件上传/下载 | MARKSZのBlog
MacOS使用Iterm2终端和lrzsz工具上传和下载文件到服务器_运维_兔角与禅-CSDN博客
iTerm2下配置ssh自动登录和使用lrzsz上传下载 – 掘金
laggardkernel/iterm2-zmodem: Installing Z-Modem integration for iTerm2 with Homebrew
brew install laggardkernel/tap/iterm2-zmodem
log
➜ ~ brew install laggardkernel/tap/iterm2-zmodem
Updating Homebrew…
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Tapping laggardkernel/tap
Cloning into ‘/usr/local/Homebrew/Library/Taps/laggardkernel/homebrew-tap’…
remote: Enumerating objects: 218, done.
remote: Counting objects: 100% (218/218), done.
remote: Compressing objects: 100% (154/154), done.
remote: Total 523 (delta 87), reused 187 (delta 63), pack-reused 305
Receiving objects: 100% (523/523), 126.83 KiB | 301.00 KiB/s, done.
Resolving deltas: 100% (232/232), done.
Tapped 3 casks and 26 formulae (55 files, 236.4KB).
==> Installing iterm2-zmodem from laggardkernel/tap
==> Installing dependencies for laggardkernel/tap/iterm2-zmodem: lrzsz
==> Installing laggardkernel/tap/iterm2-zmodem dependency: lrzsz
==> Downloading https://homebrew.bintray.com/bottles/lrzsz-0.12.20_1.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring lrzsz-0.12.20_1.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/lrzsz/0.12.20_1: 18 files, 473.5KB
==> Installing laggardkernel/tap/iterm2-zmodem
==> Downloading https://github.com/laggardkernel/iterm2-zmodem/archive/v1.0.0.tar.gz
==> Downloading from https://codeload.github.com/laggardkernel/iterm2-zmodem/tar.gz/v1.0.0
##O=# #
==> Caveats
Create triggers under Profiles -> Advanced:
Regular expression: rz waiting to receive.**B0100
结果弹框让选择script:
不知道选择啥?
选择取消掉
82:129: execution error: “iTerm”遇到一个错误:用户已取消。 (-128)
输出:
➜ ~ # Cancelled transfer
好像就可以上传文件了??
先不管,先去ssh登录服务器,去试试
选择文件去试试
问题依旧:
还是卡死。
不过稍等几十秒,提示:
[root@lin-16core3 tdengine]# rz rz waiting to receive.**B0100000023be50 [root@lin-16core3 tdengine]# # Received /Users/crifan/Downloads/TDengine-server-1.6.5.5-Linux-x64.rpm
好像可以了?
去看看:
[root@lin-16core3 tdengine]# ls -lh 总用量 5.2M -rw-r--r-- 1 root root 5.2M 2月 28 21:27 TDengine-server-1.6.5.5-Linux-x64.rpm
果然上传成功了。
但是没有进度提示,很是不爽,不过可用。
【总结】
此处Mac中iTerm2中rz上传文件:
根据:
laggardkernel/iterm2-zmodem: Installing Z-Modem integration for iTerm2 with Homebrew
直接去
brew install laggardkernel/tap/iterm2-zmodem
然后就可以了:
ssh登录远程服务器后,rz后,弹框,选择文件,即可上传文件。
不过缺点:没有进度提示。
关于进度显示:
【未解决】Mac中iTerm2中用rz上传文件没有进度条或进度指示
结论:暂时不支持,也每人去实现此功能。
另外:
即使加了进度支持,其实iTerm2中rz也不够好:
毕竟万一大文件中有控制字符,会导致终端被中断或受影响,所以也不够好。
【后记】
经过实际上传多个png图片,rpm、zip压缩包等文件确定:
- Mac版 最新版SecureCRT 8.7.0:还是会经常报错
- 虽然有进度显示,但上传最后往往会报错,而导致终端不可用
- 而iTerm2:虽然没进度显示,但是上传文件不会报错,很稳定
结论:
还是iTerm2中rz上传文件好用。而SecureCRT的rz不好用。
以后尽量用iTerm2去ssh登录服务器,用rz上传文件吧。