Linux SFTP Command

The most basic way to start an SFTP session in the command line is via:

sudo sftp server.hostname.com

Note: I am including sudo in these examples because at least in my experience, you usually need to prepend it in professional environments in order to run commands with the security privilege of root. It also helps me copy and paste it as is to the command line.

If you have a specific user account, use:

sudo sftp user@server.hostname.com

If you want to authenticate an SFTP session with a private key, use:

sudo sftp -o IdentityFile=~/path/to/privatekey.pem user@server.hostname.com

View the manual for SFTP by typing:

man sftp