Compatible with tmux, trzsz similar to rz / sz released the official version 1.0

Compatible with tmux, trzsz ( trz / tsz ) similar to rz / sz has released the official version 1.0.

  1. Support more terminals
  2. Support text progress bar
  3. Support default save path

trzsz ( trz / tsz ) is a simple file transfer tool, similar to lrzsz ( rz / sz ), and supports tmux.

GitHub:https://github.com/trzsz/trzsz 

MIT License PyPI 3 Chinese website

why?

Consider this scenario, use or inconvenience. laptop -> hostA -> hostB -> docker -> tmux  scp  sftp 

Using ( rz / sz ) is convenient in this scenario , but unfortunately it is not compatible with . lrzsz  tmux 

tmux Reluctance to support rz/sz ( 906 , 1439 ), and rebuilding a tool is a lot easier than modifying it.    tmux 

Installation Guide

Install on a remote server

  • Install with Python3

    sudo python3 -m pip install --upgrade trzsz
     
  • Install with Python2

    sudo python2 -m pip install --upgrade trzsz
     
  • Install with Homebrew

    brew update
    brew install trzsz
     

  You can also install without permissions, just add the installation path (probably ) to your environment variables. sudo  ~/.local/bin  PATH 

Supported Terminals

  Let me know if your terminal supports it too and I'll be happy to add it to this list. trzsz

user's guidance

trz upload files

trz The command can take no parameters and will upload the file to the current directory. You can also take a directory parameter to specify which directory to upload to.

trz /tmp/
 

tsz download file

tsz You can take one or more file names (you can use relative or absolute paths, or wildcards), and the specified files will be downloaded.

tsz file1 file2 file3
 

-q silent mode

trz -q or (plus the option), then no progress bar is shown while transferring files. tsz -q xxx  -q 

-y Override mode

trz -y Or (plus options), just overwrite if a file with the same filename exists. tsz -y xxx  -y 

-b binary mode

trz -b Or (plus options), binary transfer mode, which is faster for compressed packages, pictures, video, etc. tsz -b xxx  -b 

-e escape control characters

When in binary mode, control characters may fail, trz -eb or (plus options) escape all known control characters. tsz -eb xxx  -e 

-B buffer size

trz -B 10k Or wait, set the buffer size (default 1M). Too small may result in slow transfer, too large may result in untimely progress bar updates. tsz -B 2M xxx 

-t overtime time

trz -t 10 Or wait, set the timeout in seconds (default 100 seconds). Within the timeout period, if the data of a buffer size cannot be transferred, it will report an error and exit. Set to 0 or a negative number to never time out. tsz -t 30 xxx 

exception handling method

  • If not running on the remote server, but running on the local computer, or running on the springboard in the middle. tmux 

    • Only control mode is supported because the process was not found on the remote server . trzsz  tmux  tmux -CC 
    • For the usage of control mode, please refer to iTerm2 integration with tmux-CC . tmux -CC  
  • If an error occurs and it hangs and cannot move: trzsz 

    • Press the key combination to stop the or process on the server. control + c  trz  tsz 
    • For iTerm2 users, pressing a key combination stops iTerm2 Coprocesses . command + option + shift + r  
  • If the binary upload fails and the remote server is logged in with or : trz -b  telnet  docker exec

    • Try escaping all control characters, eg . trz -eb
  • If the binary upload fails and the remote server uses Python3 (versions less than 3.7): trz -b 

    • Python3 (versions less than 3.7) supports base64 mode, just use no option, use instead. -b  trz 
    • If you want to use binary upload, you need to upgrade Python3 to version 3.7 or higher, or use Python2. trz -b 
  • If the or binary transfer failed and the remote server was logged in with : trz -b  tsz -b  expect

    • You can try setting environment variables before the script , for example:  expect  export LC_CTYPE=C
      #!/bin/sh
      export LC_CTYPE=C
      expect -c '
        spawn ssh xxx
        expect "xxx: "
        send "xxx\n"
        interact
      '
       

Screenshots

trzsz Example of text progress bar in iTerm2

using trzsz in iTerm2 with text progress bar

trzsz example of zenity progress bar in iTerm2

using trzsz in iTerm2 with zenity progress bar

trzsz in tabby tabby-trzsz plugin example

using trzsz in tabby with tabby-trzsz plugin

Guess you like

Origin www.oschina.net/news/188367