My class requires for us to make the homework in a linux server, but i want to copy those files to my local machine. I've tried so far to to use the cp command but it doesn't seem to take my arguments. It always return with either the host directory does not exist or with the target directory does not exist.

My approach so far has been:

cp -R /chapter2 ~/Documents/Projects

Keep in mind that i'm connected to a remote server on ssh.

  • If you can SSH to the system, consider using rsync to bring the remote files to your local system (or SCP) – dave Sep 14 '17 at 3:39
  • 1
  • i checked the link but it still misses the part of my local machine getting a folder from the remote server. I tried using rsync but i kept getting an error saying that the directory does not exist. – 01000101.sh Sep 14 '17 at 4:32
  • 1
    Can you please add the commands you've tried and the errors you get to the question? It's hard to tell what is wrong without seeing which commands you are using ;-) – nohillside Sep 14 '17 at 6:16
  • SCP uses SSH, so if that's not working, it's probably user error. Can you give us the command you're running and the error? – JMY1000 Sep 14 '17 at 6:45

I got it to work with the help of @klanomath. It never occurred to me that the command is supposed to be executed without connection to the host@IP:. I just added -r and /*file. to the command to get all files in one instance.

scp -r host@IP:/home/username/chapter2/*.c ~/Documents/Projects

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .