Cookies on this website

We use cookies to ensure that we give you the best experience on our website. If you click 'Accept all cookies' we'll assume that you are happy to receive all cookies and you won't see this message again. If you click 'Reject all non-essential cookies' only necessary cookies providing core functionality such as security, network management, and accessibility will be enabled. Click 'Find out more' for information on how to change your cookie settings.

How to transfer files using the SFTP command line tool

The sftp command provides an interactive file transfer client, although it can be used in a one-off transfer manner to get individual files. Whilst it is more complex to use than scp, it may be more efficient when you have many files to transfer that can't be specified (easily) with wildcards, especially when you are connecting to a system using multi-factor authentication (such as BMRC's cluster).

In addition, some services only support SFTP connections, such as the WIN MRI download system when used with SFTP Only accounts.

The basic sftp command syntax is

sftp destination

where destination is of the form user@host:path. As with scp, user@ is optional if the username is the same on your computer as the remote service and if path is not specified then it will use your remotely configured home folder.

When you have authenticated you will get a prompt that can be used to move around the remote file system; use 'cd' and 'ls' as you would on a UNIX system to change directory and list the contents. You can also interact with your local file system with the 'lcd' and 'lls' equivalents.

To upload files/folders use 'put' and to download use 'get' with the filename of the local or remote object respectively.