Using Scp to transfer files
The following examples should illustrate how to use scp to
easily transfer files to and from your Duke Statistics account, depending on whether
you are:
- logged onto a remote unix host.
- To copy
myfilefrom your account onremoteto your home directory at Duke Statisticsremote% scp myfile isdsmachine:
- To copy
myfilefromremoteto thedir1subdirectory of your Duke Statistics accountremote% scp myfile isdsmachine:dir1
- To copy
myfilefrom your Duke Statistics account to your home directory onremoteremote% scp isdsmachine:myfile .
- To recursively copy
mydirfrom your Duke Statistics home directory to your account onremoteremote% scp -r isdsmachine:mydir .
- To copy
- logged onto an Duke Statistics machine.
- To copy
myfilefrom your Duke Statistics home directory to your account onremoteisdsmachine% scp myfile remote:
- To recursively copy
mydirfrom your Duke Statistics home directory to your account onremoteisdsmachine% scp -r mydir remote:
- To copy
myfilefrom your account onremoteto your Duke Statistics home directoryisdsmachine% scp remote:myfile .
- To copy
For a complete list of all the options for scp, check out
the online man page.
Some caveats while using scp:
- If your userid (login) is different between your remote and Duke Statistics
accounts, you need to use the
userid@machinesyntax. For example, if your Duke Statistics userid is "jimbo" but your remote userid is "jtkirk":remote% scp myfile jimbo@isdsmachine: remote% scp jimbo@isdsmachine:myfile . isdsmachine% scp myfile jtkirk@remote: isdsmachine% scp jtkirk@remote:myfile .
- Wildcard characters need to be "escaped" when included in the
non-local portion of the scp command.
If you want to transfer all of the files on a remote machine that start with the letter x, you need to escape the "*".
isdsmachine% scp remote:x\* .
However, if you want to copy all of the local files starting with the letter x, you need only do the following,
isdsmachine% scp x* remote:
