User Tools

Site Tools


linux:scp

Linux: How to copy files from one account to another using scp

Using scp it is possible to copy files (and directories) from one Linux account to the other.

In general, scp is followed by what to copy, and then by where to copy it. In case of directories, the -r switch can be used to copy recursively. Note that ~ refers to the home directory of a user, and . refers to the current directory. Remote paths consist of the user name (like tue+s0123456), followed by an @ symbol, a machine name, a colon, and path on the target machine for the target user. For the machine name you can use the same name as the machine you current work on. The name is included at each prompt in the command terminal, as well as in the title bar of the terminal.

Some examples:

  • scp *.scim* tue+s0123456@se-123:~
    • Copies all files that match *.scim* (all .scim and .scim_diagram files) from the current directory to the home directory (~) of user tue+s0123456.
  • scp -r 4k420 tue+s0123456@se-123:~
    • Copies directory 4k420 recursively (thus the -r) from the current directory to the home directory (~) of user tue+s0123456.
  • scp tue+s0123456@se-123:~/4k420/*.cift* .
    • Copies all files that match *.cift* (all .cift and .cift_diagram files) from the 4k420 directory in the home directory of user tue+s0123456 to the current directory (.).

For more information on scp, see Wikipedia or the University of Colorado scp information page, or the OpenBSD scp man page.

linux/scp.txt · Last modified: Tuesday, 14 September 2010 : 14:40:12 by dhendriks