If you are provided with a remote host and asked to copy a file from there to your local computer, you can make use of the SFTP Get command, let's take a look,
Syntax: get {remote-path/to/the/file} {destination/path}
Example:sftp> get /pub/example/readme.txt myRemoteFiles
Fetching /pub/example/readme.txt to myRemoteFiles
/pub/example/readme.txtn. 100% 405 0.9KB/s 00:00
sftp>
The easiest way is to first be on the path where you want to copy this file to and connect to the remote server using SFTP and then use dot (.) to copy the file in the current location you are in.
Example:sftp> get /pub/example/readme.txt .
Fetching /pub/example/readme.txt to .
/pub/example/readme.txt 100% 405 0.9KB/s 00:00
sftp>
![Copy a remote file to local using SFTP command Copy a remote file to local using SFTP command](https://code2care.org/q/copy-remote-file-to-local-using-sftp-command/images/Copy a remote file to local using SFTP command.png)
Copy a remote file to local using SFTP command
More Posts related to FTP,
- Check help on commands while being on sftp> prompt
- How to connect to SFTP location using Terminal command
- List of 60 useful FTP Client Commands to access server
- 10 FTP SFTP Clients and Alternatives
- How to Copy a remote file to local using SFTP command?
- How to switch between sftp and Terminal shell
- [Solution] SFTP Connection closed File 22 not found
- FileZilla Connection time out Failed to retrieve directory listing
- How to SFTP to port different than 22 (SFTP Custom port)
More Posts:
- Fix - Website Connection timed out Error Code 522 (Cloudflare) - HowTos
- How to check PowerShell version - Powershell
- WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. - PIP
- Program 14: Sum of Even Numbers from 1 to 100 - 1000+ Python Programs - Python-Programs
- Spring Boot CRUD Examples using JDBCTemplate - Java
- [Fix] Microsoft AADSTS900561: The endpoint only accepts POST requests. Received a GET request. - Microsoft
- Limit scrollback rows in macOS Terminal - MacOS
- How to know your iPhone Model Name - iOS