scp home directory - A shortcut to refer to your home directory

I learned a shortcut the other day about how to use the scp or pscp commands to securely copy files between computer systems using SSL. I used to always type an scp command like this to copy a file named myfile.tar from my local computer to my home directory on a remote system:

scp myfile.tar user@remoteserver.com:/home/al

The key/bad part of that command is that I type out the full path to my home directory. Technically, it's not bad, just long, and it would be worse if my name was longer than "al". Here's how you can do the same thing using the shortcut I learned:

scp myfile.tar user@remoteserver.com:./

Just use ./ instead of the full path to your home directory.

Knowing that simple trick, here's a collection of scp/pscp commands you can use to securely copy files from one computer system to another.

How to copy from /tmp on a remote server to the current directory on a local computer:

scp user@remoteserver.com:/tmp/myfiles.tar .

How to copy from your home directory on a remote server to the current directory on a local computer:

scp user@remoteserver.com:./myfiles.tar .

How to copy a file from the local computer to /tmp on a remote computer:

scp myfile.doc user@remoteserver.com:/tmp

How to copy a file from the local computer to your home directory on a remote computer:

scp myfile.doc user@remoteserver.com:./