Use scp to copy files to the home directory without having to specify it

scp

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?

Best Answer

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).

Related Question