Red Hat Enterprise Linux 9 Essentials Book now available.
Purchase a copy of Red Hat Enterprise Linux 9 (RHEL 9) Essentials
Red Hat Enterprise Linux 9 Essentials Print and eBook (PDF) editions contain 34 chapters and 298 pages
9.3.3. Using the sftp Utility
The sftp utility can be used to open a secure, interactive FTP session. In its design, it is similar to ftp except that it uses a secure, encrypted connection.
To connect to a remote system, use a command in the following form:
sftp username@hostname
For example, to log in to a remote machine named penguin.example.com with john as a username, type:
After you enter the correct password, you will be presented with a prompt. The sftp utility accepts a set of commands similar to those used by ftp (see Table 9.3, “A selection of available sftp commands”).
Table 9.3. A selection of available sftp commands
Command
Description
ls [directory]
List the content of a remote directory. If none is supplied, a current working directory is used by default.
cddirectory
Change the remote working directory to directory.
mkdirdirectory
Create a remote directory.
rmdirpath
Remove a remote directory.
putlocalfile [remotefile]
Transfer localfile to a remote machine.
getremotefile [localfile]
Transfer remotefile from a remote machine.
For a complete list of available commands, refer to the sftp man page.