Skip to content
/ trzsz-go Public

trzsz-go is the go version of trzsz, makes all terminals that support local shell to support trzsz ( trz / tsz ).

License

Notifications You must be signed in to change notification settings

trzsz/trzsz-go

Repository files navigation

trzsz-go ( trz / tsz ) - the go version of trzsz

MIT License GitHub Release WebSite 中文文档

trzsz-gomakes all terminals that support local shell to supporttrzsz( trz / tsz ), which similar to ( rz / sz ), and compatible with tmux.

⭐ It's recommended to use the go version oftrzszon the server, usetrzsz-ssh ( tssh )on local.

Please checkhttps://trzsz.github.iofor more information abouttrzsz ( trz / tsz ).

Installation

  • Install with apt on Ubuntu

    sudo apt install trzsz
    sudo apt update&&sudo apt install software-properties-common
    sudo add-apt-repository ppa:trzsz/ppa&&sudo apt update
    
    sudo apt install trzsz
  • Install with apt on Debian

    sudo apt install trzsz
    sudo apt install curl gpg
    curl -s'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x7074ce75da7cc691c1ae1a7c7e51d1ad956055ca'\
    |gpg --dearmor -o /usr/share/keyrings/trzsz.gpg
    echo'deb [signed-by=/usr/share/keyrings/trzsz.gpg] https://ppa.launchpadcontent.net/trzsz/ppa/ubuntu jammy main'\
    |sudo tee /etc/apt/sources.list.d/trzsz.list
    sudo apt update
    
    sudo apt install trzsz
  • Install with yum on Linux

    sudo yum install trzsz
    • Install withgemfuryrepository.

      echo'[trzsz]
      name=Trzsz Repo
      baseurl=https://yum.fury.io/trzsz/
      enabled=1
      gpgcheck=0'|sudo tee /etc/yum.repos.d/trzsz.repo
      
      sudo yum install trzsz
    • Install withwlnmprepository. It's not necessary to configure the epel repository for trzsz.

      curl -fsSL"https://sh.wlnmp.com/wlnmp.sh"|bash
      
      sudo yum install trzsz
  • Install withyayon ArchLinux

    yay -S trzsz
    yay -Syu
    yay -S trzsz
  • Install withhomebrewon MacOS

    brew install trzsz-go
    brew update
    brew install trzsz-go
  • Install withscoop/winget/chocoon Windows

    scoop install trzsz/winget install trzsz/choco install trzsz
    scoop install trzsz
    winget install trzsz
    choco install trzsz
  • Install with Go ( Requires go 1.20 or later )

    go install github.com/trzsz/trzsz-go/cmd/...@latest
    go install github.com/trzsz/trzsz-go/cmd/trz@latest
    go install github.com/trzsz/trzsz-go/cmd/tsz@latest
    go install github.com/trzsz/trzsz-go/cmd/trzsz@latest

    The binaries are usually located in~/go/bin/(C:\Users\your_name\go\bin\on Windows ).

  • Build from source ( Requires go 1.20 or later )

    sudo make install
    git clone --depth 1 https://github.com/trzsz/trzsz-go.git
    cdtrzsz-go
    make
    sudo make install
  • Download from theGitHub Releases,unzip and add toPATHenvironment.

Usage

Use on the local computer

  • Addtrzszbefore the shell to support trzsz ( trz / tsz ), e.g.:

    trzsz bash
    trzsz PowerShell
    trzsz ssh x.x.x.x
  • Addtrzsz --dragfilebefore thesshto enable drag files and directories to upload, e.g.:

    trzsz -d ssh x.x.x.x
    trzsz --dragfile ssh x.x.x.x

Use on the jump server

  • If usingtmuxon the jump server, usetrzsz --relay sshto login to the remote server, e.g.:

    trzsz ssh jump_server
    tmux
    trzsz --relay ssh remote_server

Use on the remote server

Suggestion

  • It is recommended to setalias ssh= "trzsz ssh"for convenience,alias ssh= "trzsz -d ssh"for dragging files to upload.

  • If usingtmuxon the local computer, runtmux( withouttrzsz) first, thentrzsz sshto login.

Zmodem support

  • Use-zor--zmodemto enable therz / szfeature. e.g.,trzsz -z ssh remote_server.

  • lrzszneeds to be installed on the client ( local computer ). e.g.,brew install lrzsz,apt install lrzsz,etc.

  • trzsz --zmodem ssh xxxis not supported on Windows. You can usetrzsz-ssh ( tssh )instead,tssh --zmodem xxx.

  • About the progress, the transferred and speed are not precise, there will be some deviation. It just indicating that the transfer is in progress.

Clipboard integration

  • Use-oor--osc52to enable the clipboard integration feature. e.g.,trzsz -o ssh remote_server.

  • Clipboard integration allows remote servers to write to the local clipboard via OSC52 sequences.

  • On Linux, clipboard integration requiresxcliporxselcommand to be installed.

Configuration

trzszlooks for configuration at~/.trzsz.conf(C:\Users\your_name\.trzsz.confon Windows ), e.g.:

DefaultUploadPath =
DefaultDownloadPath = /Users/username/Downloads/
DragFileUploadCommand = trz -y
ProgressColorPair = B14FFF 00FFA3
  • If theDefaultUploadPathis not empty, the path will be opened by default while choosing upload files.

  • If theDefaultDownloadPathis not empty, downloading files will be saved to the path automatically instead of asking each time.

  • The default value ofDragFileUploadCommandistrz,configure it totrz -yif you want to overwrite the existing files, configure it torzif you want to userzto upload.

  • TheProgressColorPairconfigures the color of the progress bar. You need to configure 2 colors and do not include#.The progress bar will gradient from the first color to the second color.

Trouble shooting

  • If usingMSYS2orGit Bashon windows, and getting an errorThe handle is invalid.

    • Installwinptybypacman -S winptyinMSYS2.
    • Git Bashshould have winpty installed, no need to install it manually.
    • Addwinptybeforetrzsz,e.g.:winpty trzsz ssh x.x.x.x.
  • The/usr/bin/sshinMSYS2andCygwinis not supported yet, use theOpenSSHinstead.

    • InMSYS2,e.g.:winpty trzsz /c/Windows/System32/OpenSSH/ssh.exe x.x.x.x.
    • InCygwin,e.g.:trzsz "C:\Windows\System32\OpenSSH\ssh.exe" x.x.x.x.
    • ⭐ Recommended to usetrzsz-ssh( tssh ) instead,tsshis same astrzsz ssh.
  • Dragging files doesn't upload?

    • Don't forget the--dragfileoption. e.g.:trzsz -d ssh x.x.x.x.
    • Make sure thetrzin one of thePATHdirectory on the server.
    • On Windows, make sure there is noAdministratoron the title.
    • ThecmdandPowerShellonly support draging one file into it.
    • On the Windows Terminal, drag files to the top left where showsPaste path to file.

Development

Want to write your own ssh client that supports trzsz? Please check thego ssh client example.

Screenshot

Windows

windows trzsz ssh

Ubuntu

ubuntu trzsz ssh

Drag files

drag files ssh

Contact

Feel free to email the author[email protected],or create anissue.Welcome to join the QQ group: 318578930.

Sponsor

❤️ Sponsor trzsz ❤️,buy the author a drink 🍺? Thank you for your support!