user1551817
user1551817

Reputation: 7451

using scp in terminal

I have created a file on a remote computer that I have ssh-ed into. I want to transfer the file back to the laptop I am using at the moment. I see that I am supposed to use the command:

scp username@server:/home/username/file_name /home/local-username/file-name

But I'm not still not sure of what I should use for my laptop (which is a macbook). For "home' I guess I use the path that appears when I type pwd into my terminal when it opens?

I try this and I get the message:

No such file or directory

I know this is easy stuff but I've not done it before. Any help would be great. Thank you.

Upvotes: 33

Views: 168974

Answers (3)

Aziz Zoaib
Aziz Zoaib

Reputation: 771

Simple :::

scp remoteusername@remoteIP:/path/of/file /Local/path/to/copy

scp -r remoteusername@remoteIP:/path/of/folder /Local/path/to/copy

Upvotes: 4

Gilles Quénot
Gilles Quénot

Reputation: 185025

You can download in the current directory with a . :

cd # by default, goes to $HOME
scp me@host:/path/to/file .

or in you HOME directly with :

scp me@host:/path/to/file ~

Upvotes: 6

Matt DiMeo
Matt DiMeo

Reputation: 1136

I would open another terminal on your laptop and do the scp from there, since you already know how to set that connection up.

scp username@remotecomputer:/path/to/file/you/want/to/copy where/to/put/file/on/laptop

The username@remotecomputer is the same string you used with ssh initially.

Upvotes: 53

Related Questions