Transfer Files with iTerm sz/rz

This is a quick guide on transferring files between your local system and a remote server.

1. Download iTerm:

2. Install lrzsz package in iTerm terminal

sudo brew install lrzsz

3. Add the following scripts to usr/local/bin in both local and remote server

4. Change Permission for iTerm scripts (both local & remote server)

chmod 777 iterm2-*

5. Set up iTerm2 triggers

  • iTerm2’s [preference] -> [profile] -> [advanced] -> [triggers] -> [edit]
Regular expression: rz waiting to receive.\*\*B0100
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-send-zmodem.sh
Regular expression: \*\*B00000000000000
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-recv-zmodem.sh

6. Transfer files

  1. On receiving side: execute ‘rz’. This will open a prompt for you to select the file you are preparing to receive.
  2. On sending side: execute ‘sz’. This will open a prompt for you to select the file to send.

And voilà, if you’ve followed these simple steps, you should have successfully sent your file over to your remote server! Hope this helped at least 1 person. I had to reference several articles to get this done [listed below] so I decided to compile all of it into 1 article.

References:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store