2

I've followed this tutorial to see how to use scp to transfer files to my server. And all is well. So I'm using commands like this:

scp examplefile yourusername@yourserver:/home/yourusername/

But I'm wondering if there's a way for me to not have to specify the destination with the appended /home/yourusername/. I'm already using the username in the address, is there a way to make the home directory on the remote user the "base" of the file transfer destination?

Or, to clarify, I want to be able to send files to the home directory of the user on the remote computer (yourusername@yourserver:/home/yourusername/) with a command like this:

scp examplefile yourusername@yourserver

Is it possible? Feasible?

5

Using username@server: as the target should be enough, i.e.

scp somefile username@server:

This would copy the file somefile to the server server and place it in the home directory of the user username. By "home directory" I mean whatever directory will be the default one that this user arrives in when logging in on the server system using ssh (most likely /home/username).

1

or your can do as below instead.

scp myfile username@host:./

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.