Search code examples
linuxubuntusshscp

Where is my folder copied when I scp from a server to a name


So I wanted to copy a folder from a remote server to my local computer. I am using WSL (Windows Subsystem for Linux)/ Ubuntu.

First, I ssh into the server using ssh user@host. Then I wrote the scp command which is scp -r user@host:/var/www backup-9-feb

But now I cant find this backup-9-feb folder, please help. Unfortunately, I forgot the name of the folder too. This is just an example.

After I executed these commands, A long list of files with there paths were shown


Solution

  • You don't need to ssh into the server to use scp. You want to do the following on your computer: scp -r server_user@server_host:/var/www backup-9-feb. This will copy (recursively) the directory /var/www of the server to the directory where you ran this command on your machine.

    Note: scp is going to be deprecated so you probably want to start using an utility like rsync (works similarly).