How to download a file from server using SSH?

NiLL picture NiLL · Feb 24, 2012 · Viewed 1.5M times · Source

I need to download a file from server to my desktop. (UBUNTU 10.04) I don't have a web access to the server, just ssh.

If it helps, my OS is Mac OS X and iTerm 2 as a terminal.

Answer

Josh1billion picture Josh1billion · Feb 24, 2012

In your terminal, type:

scp [email protected]:foobar.txt /local/dir

replacing the username, host, remote filename, and local directory as appropriate.

If you want to access EC2 (or other service that requires authenticating with a private key), use the -i option:

scp -i key_file.pem [email protected]:/remote/dir/foobar.txt /local/dir

From: http://www.hypexr.org/linux_scp_help.php