SFTP offers a secure way to transfer files between computers with encryption. Although many people assume the acronym stands for Secure File Transfer Protocol, it is actually the SSH File Transfer Protocol.
SFTP is a variation of the File Transfer Protocol (FTP), which is one of the oldest internet applications. Both SFTP and FTP are standard definitions, not programs. It is up to others to write an SFTP program, but they must follow the SFTP standard in order to make it compatible with other SFTP programs.
In a standard implementation, an SFTP program runs at the command line. The utility has its own environment. So when you enter an SFTP session, you should see the command line prompt change to sftp>.
Once logged into an SFTP session, normal commands for the operating system won’t work. Instead, you must use the command language specified in the SFTP standard.
Most frequently used SFTP commands
Here is a list of the most commonly used SFTP commands and their meanings:
|?||List of all commands or explain a command, eg ? get|
|!||Leave the environment temporarily *|
|cd||Change the active directory on the remote host|
|chmod||Change the permissions of files on the remote host|
|chown||Change the owner of files on the remote host|
|dir||List the contents of the current directory on the remote host|
|exit||Close the connection and leave SFTP|
|get||Copy a file from the remote host to the local computer|
|help||Same as ?|
|lcd||Change the active directory on the local computer|
|lls||List the contents of the current directory on the local computer|
|lmkdir||Create a directory on the local computer|
|ln||Create a symbolic link for a file on the remote host|
|lpwd||Show the present working directory on the local computer|
|ls||Same as dir|
|lumask||Change the local umask value|
|mkdir||Create a directory on the remote host|
|put||Copy a file from the local computer to the remote host|
|pwd||Show the present working directory on the remote host|
|quit||Same as exit|
|rename||Rename a file on the remote host|
|rm||Delete a file on the remote host|
|rmdir||Remove an empty directory on the remote host|
|symlink||Same as ln|
|version||Show the SFTP version|
* to return to SFTP type exit. Execute commands in the underlying operating system without leaving SFTP by putting ! in front of the command, eg !date
Not every computer will have an SFTP program, but just about all computers do have FTP. For example, FTP is bundled into all Microsoft operating systems, but SFTP isn’t. There are also GUI versions of SFTP available and they take care of all of the commands for you through interpretive buttons and menu options. Whether you prefer a GUI SFTP implementation or you want to use the system at the command line, you will need to find and install an SFTP utility.
Do you have a favorite SFTP program that you use a lot? Leave a message in the comments section below and let us all know about it.
See also: SolarWinds SFTP/SCP Server review