How to Download a File or Directory via SSH

There may be times when you find it more efficient to download a file or directory via SSH rather than a SFTP GUI. Here’s how to do that:

To download a single file:

scp username@source_host:path/to/source_file.zip ~/Desktop

To Download a directory (folder):

Use the -r option

scp -r username@source_host:path/to/source_folder ~/Desktop

If you’d like to change the destination location for either of these commands, simply replace /Desktop with the path of your desired destination.