Transfer files - kitty
Description: Transfer files to and from remote computers over the TTY device itself. This means that file transfer works over nested SSH sessions, serial links, etc. Anywhere you have a terminal device, you can...

Hide navigation sidebar
Hide table of contents sidebar
Toggle table of contents sidebar

# Transfer files

Warning

This kitten is currently experimental, use with care.

Transfer files to and from remote computers over the `TTY` device itself. This means that file transfer works over nested SSH sessions, serial links, etc. Anywhere you have a terminal device, you can transfer files.

This kitten supports transferring entire directory trees, preserving soft and hard links, file permissions, times, etc. It even supports the rsync protocol to transfer only changes to large files.

See also

See the Remote files kitten

Note

This kitten (which practically means kitty) must be installed on the other machine as well. If that is not possible you can use the Remote files kitten instead. Or write your own script to use the underlying file transfer protocol.

New in version 0.24.0.

## Basic usage

In what follows, the local computer is the computer running this kitten and the remote computer is the computer connected to the other end of the TTY pipe.

To send a file from the local computer to the remote computer, simply run:

    kitty +kitten transfer /path/to/local/file /path/to/destination/on/remote/computer

You will be prompted by kitty for confirmation on allowing the transfer, and if you grant permission, the file will be copied.

Similarly, to get a file from the remote computer to the local computer, use the `kitty +kitten transfer --direction` option:

    kitty +kitten transfer --direction=receive /path/to/remote/file /path/to/destination/on/local/computer

Multiple files and even directories can be transferred:

    kitty +kitten transfer file1 dir1 destination/

Here `file1` will be copied inside `destination` and `dir1` will be recursively copied into `destination`. Note the trailing slash on `destination`. This tells kitty the destination is a directory. While not strictly necessary (kitty will infer the need for a destination directory from the fact that you are copying multiple things) it is good practice to always use a trailing slash when the destination is supposed to be a directory.

Also, when transferring multiple files/directories it is a good idea to use the `kitty +kitten transfer --confirm-paths` option which will give you an opportunity to review and confirm the files that will be touched.

## Avoiding the confirmation prompt

Normally, when you start a file transfer kitty will prompt you for confirmation. This is to ensure that hostile programs running on a remote machine cannot read/write files on your computer without your permission. If the remote machine is trusted and the connection between your computer and the remote machine is secure, then you can disable the confirmation prompt by:

1. Setting the `file_transfer_confirmation_bypass` option to some password.

2. When invoking the kitten use the `kitty +kitten transfer --permissions-bypass` to supply the password you set in step one.

Warning

Using a password to bypass confirmation means any software running on the remote machine could potentially learn that password and use it to gain full access to your computer. Also anyone that can intercept the data stream between your computer and the remote machine can also learn this password. So use it only with secure connections to trusted computers.

## Delta transfers

This kitten has the ability to use the rsync protocol to only transfer the differences between files. To turn it on use the `kitty +kitten transfer --transmit-deltas` option. Note that this will actually be slower when transferring small files because of round trip overhead, so use with care.

## Source code for transfer

The source code for this kitten is available on GitHub.

## Command Line Interface

    kitty +kitten transfer [options] source_files_or_directories destination_path

Transfer files over the TTY device

### Options

--direction <DIRECTION>, -d <DIRECTION>

  Whether to send or receive files. Default: `send` Choices: `receive`, `send`

--mode <MODE>, -m <MODE>

  How to interpret command line arguments. In `mirror` mode all arguments are assumed to be files on the sending computer and they are mirrored onto the receiving computer. In `normal` mode the last argument is assumed to be a destination path on the receiving computer. Default: `normal` Choices: `mirror`, `normal`

--permissions-bypass <PERMISSIONS_BYPASS>, -p <PERMISSIONS_BYPASS>

  The password to use to skip the transfer confirmation popup in kitty. Must match the password set for the `file_transfer_confirmation_bypass` option in kitty.conf. Note that leading and trailing whitespace is removed from the password. A password starting with ., / or ~ characters is assumed to be a file name to read the password from. A value of - means read the password from STDIN. A password that is purely a number less than 256 is assumed to be the number of a file descriptor from which to read the actual password.

--confirm-paths, -c

  Before actually transferring files, show a mapping of local file names to remote file names and ask for confirmation.

--transmit-deltas, -x

  If a file on the receiving side already exists, use the rsync algorithm to update it to match the file on the sending side, potentially saving lots of bandwidth and also automatically resuming partial transfers. Note that this will actually degrade performance on fast links with small files, so use with care.