Sep 2017 Update - tl; dr
Download one file from a remote ftp server to your computer:
sftp username@hostname:remoteFileName localFileName
Upload one file from your computer to the remote ftp server:
sftp {user}@{host}:{remote_dir} <<< $'put {local_file_path}'
Original answer:
OK, I feel a little dumb. But I realized that. I almost had it on top:
sftp user@host remoteFile localFile
The only documentation shown on the terminal is this:
sftp [user@]host[:file ...] sftp [user@]host[:dir[/]]
However, I came across this site , which shows the following in a summary:
sftp [-vC1 ] [-b batchfile ] [-o ssh_option ] [-s subsystem | sftp_server ] [-B buffer_size ] [-F ssh_config ] [-P sftp_server path ] [-R num_requests ] [-S program ] host sftp [[user@]host[:file [file]]] sftp [[user@]host[:dir[/]]]
So, the simple answer is: just do it : after your user and host, and then the remote file and local file name. Incredibly simple!
Single line, remote sftp copy file:
sftp username@hostname:remoteFileName localFileName sftp kyle@kylesserver:/tmp/myLogFile.log /tmp/fileNameToUseLocally.log
February 2016 update
In case someone is looking for a command to do the opposite of this, and click the file from the local computer to the remote server in one sftp line, the user @Thariama below posted the solution for this. The tail will tell them an additional code.
sftp {user}@{host}:{remote_dir} <<< $'put {local_file_path}'
Kyle May 23 '13 at 20:19 2013-05-23 20:19
source share