Go to main content

Managing Remote Systems in Oracle® Solaris 11.3

Exit Print View

Updated: October 2017
 
 

Specifying the Source and Target for Copy Operations

With the scp command, you can specify the source (the file or directory to be copied) and the target (the location in which to copy the file or directory). You can shorten the path strings by using the tilde character (~) and the shell wildcard characters (*, ?, and so forth).

The tilde character (~) is expanded by all shell programs to be the current user's home directory. The current user is the user under which the shell is executing. If the home directory for the user jack is /export/home/jack, then for the user jack, ~/myfile.txt expands to /export/home/jack/myfile.txt.

    This expansion also works for remote paths. If the user jack wants to copy a file from his home directory, then these three path descriptions are equivalent:

  • host3:/export/home/jack/myfile.txt

  • host3:~/myfile.txt

  • host3:myfile.txt

This expansion is also useful when referring to another user's remote home directory. In this case, you would include the user's name after the tilde character. For the user jack, host3:~jill/myfile.txt is equivalent to host3:/export/home/jill/myfile.txt, but it is shorter to type.