Network and File Transfers
In order to login or transfer files to a remote Linux file system, you must know the hostname (unique network identifier) and the username. If you are already on a Linux file system, those are easy to determine using the following commands:
$ whoami
wallen
$ hostname -f
login4.ls6.tacc.utexas.edu
Given that information, a user would remotely login to this Linux machine using the Terminal command:
$ ssh wallen@ls6.tacc.utexas.edu
(enter password)
(enter token)
Windows users would typically use the program PuTTY to perform this operation. Logging out of a remote system is done using the logout command, or the shortcut <Ctrl+d>:
[ls6]$ logout
[local]$
To practice transferring files to Lonestar6’s $WORK and $SCRATCH, we need to identify the path to our $WORK and $SCRATCH directory. To identify these paths, we can use helpful command shortcuts.
To identify the path to our $WORK directory, we can use cd $WORK or the helpful shortcut cdw:
$ cdw
$ pwd
/work/03439/wallen/ls6
To identify the path to our $SCRATCH directory, we can use cd $SCRATCH or the helpful shortcut cds:
$ cds
$ pwd
/scratch/03439/wallen
Copying files from your local computer to Lonestar6’s $WORK would require the scp command (Windows users use the program “WinSCP”):
[local]$ scp my_file wallen@ls6.tacc.utexas.edu:/work/03439/wallen/ls6
(enter password)
(enter token)
In this command, you specify the name of the file you want to transfer (my_file), the username (wallen), the hostname (ls6.tacc.utexas.edu), and the path you want to put the file (/work/03439/wallen/ls6). Take careful notice of the separators including spaces, the @ symbol, and the colon.
Copying files from your local computer to Lonestar6’s $SCRATCH using scp:
[local]$ scp my_file wallen@ls6.tacc.utexas.edu:/scratch/03439/wallen
(enter password)
(enter token)
Copy files from Lonestar6 to your local computer using the following:
[local]$ scp wallen@ls6.tacc.utexas.edu:/work/03439/wallen/ls6/my_file ./
(enter password)
(enter token)
Note: If you wanted to copy my_file from $SCRATCH, the path you would specify after the colon would be /scratch/03439/wallen/my_file.
Instead of files, full directories can be copied using the “recursive” flag (scp -r ...). The rsync tool is an advanced copy tool that is useful for synching data between two sites. Although we will not go into depth here, example rsync usage is as follows:
$ rsync -azv local remote
$ rsync -azv remote local
This is just the basics of copying files. See example scp usage here-1 and example rsync usage here-2.
Exercise
Identify which Lonestar6 login node you are on (login1, login2, login3)
Remotely login to a different Lonestar6 login node and list what files are available.
Logout until you are back to your original login node.
Make your own
my_fileon your local computer using knowledge from our previous sections and copymy_fileto your$WORKfile system on Lonestar6
Review of Topics Covered
Command |
Effect |
|---|---|
|
print hostname |
|
print username |
|
remote login |
|
logout |
|
navigate to |
|
navigate to |
|
copy a file from local to remote |
|
copy a file from remote to local |
|
sync files between local and remote |
|
sync files between remote and local |
|
logout of host |