Skip to content

Transfer files

You can leave out the VPS name below when your Account has one VPS: write :path instead of my-vps:path. With several, lt asks which one, or you pass its name or ID.

Terminal window
lt cp ./project my-vps:work # upload the folder project into ~/work
lt cp my-vps:work/report.pdf . # download a file
lt cp notes.md todo.md :inbox/ # several files at once

One side is on your computer and the other on the VPS, written vps:path. A path on the VPS starts in your home folder there (/home/dev), so my-vps:work is ~/work. Folders are copied with everything in them.

  • folder copies the folder itself; folder/ copies what is inside it.
  • Only files that changed are sent, compressed. Add --no-compress for files that are already compressed, like videos or archives.
  • If a copy is interrupted, run the same command again: it continues where it stopped.

lt cp uses rsync over the same private SSH connection as lt term-ssh. Install rsync if your computer doesn’t have it:

Terminal window
sudo apt install rsync # Debian, Ubuntu
brew install rsync # macOS

Without it, lt cp says so and copies with scp instead, which sends every file again.

Terminal window
lt cp box-a:work box-b: # ~/work on box-a into the home folder on box-b
lt cp box-a:site/ box-b:site # what is inside ~/site on box-a into ~/site on box-b

Name both VPSs. The files go through your computer, but are not saved on it, and you don’t need rsync for this. The copy always sends everything, and it doesn’t resume: if it is interrupted, run it again and it starts from the beginning.

If the destination is an existing folder, or ends with /, the files go inside it. Otherwise a single file is saved under the destination’s name, and a folder or several files become a new folder with that name.

To copy within one VPS, open a terminal there with lt term-ssh my-vps and run cp -a work work-copy.

Terminal window
lt sync ./site my-vps:site # make ~/site on the VPS match ./site
lt sync my-vps:site ./site # the other way round

lt sync makes the destination folder an exact copy of the source folder: new and changed files are copied, and files the source doesn’t have are deleted from the destination.

Before deleting anything, lt sync lists the files it would delete and asks you to confirm. When nothing would be deleted, it just syncs. Add --yes to skip the question, for example in a script, where lt sync otherwise stops without changing anything.

To leave files out, add --exclude, or list patterns in a .ltignore file in the folder on your computer, one per line, in rsync’s exclude format:

node_modules/
*.log
.env

Files left out are neither copied nor deleted on the other side.

lt sync needs rsync on your computer.