File transfer to/from Arrhenius using scp¶
There are multiple ways to transfer data to/from Arrhenius.
Here, we show how to transfer files and folders using a command-line tool
called scp,
which is a secure file transfer tool
that works under Linux, Mac and Windows.
- Copy a file from your local computer to Arrhenius
- Copy a file from Arrhenius to your local computer
- Copy a folder from your local computer to Arrhenius
- Copy a folder from Arrhenius to your local computer
Introduction¶
Info
-
Terminal transfer tools are handy when you are already working in the terminal and can sometimes be superior to Graphical tools.
- Only tool type for scripting
- No switching applications
- Tab completion can make finding files faster
- If you work on servers or over ssh you might not be able to use a graphical user interface (GUI).
scphas the similar arguments as for the linux copy functioncp.sftpis more versatile with more file management capabilities. Optional lesson-
rsyncis perfect for syncing and have many capabilities. Optional lesson -
All are considered secure!
Pros
- Simple
- One-line command
- Use cases
- copy just a file
- copy just a specific directory (with sub-directories).
When not to use
- When needing several one-line commands
- requires credentials every time
- When looking to do more than a basic file transfer, SCP falls short.
- Transfers that are interrupted you have to restart the entire transfer.
- A file with the same name in the same directory is transferred, will be overwritten.
Risk of overwriting files
- There is no warning if a file is about to be overwritten.
- There is no
scp -i ...as forrm -ithat asks if you really want to remove the file.
- There is no
rsyncmay be a better tool if you want to sync existing content.
Copy a file from local to Arrhenius¶
flowchart LR
local_computer[Your local computer. Run scp from here]
arrhenius[Arrhenius]
local_computer --> |scp| arrhenius
Copy a file from a local computer to a Arrhenius home folder.
On your local computer, do:
For example:
Copy a file from Arrhenius to local¶
flowchart LR
local_computer[Your local computer. Run scp from here]
arrhenius[Arrhenius]
arrhenius --> |scp| local_computer
Copy a file from Arrhenius to your local computer.
On your local computer, do:
scp [user_name]@login.hpc.arrhenius.naiss.se:/home/[user_name]/[file_name] [local_folder_destination]
For example:
Where . means 'the folder where I am now'.
Copy a folder from local to Arrhenius¶
flowchart LR
local_computer[Your local computer. Run scp from here]
arrhenius[Arrhenius]
local_computer --> |scp| arrhenius
Copy a folder from a local computer to a Arrhenius home folder.
On your local computer, do:
For example:
The -r flag is used to
copy a folder and all of its subfolders.
Copy a folder from Arrhenius to local¶
flowchart LR
local_computer[Your local computer. Run scp from here]
arrhenius[Arrhenius]
arrhenius --> |scp| local_computer
Copy a folder from Arrhenius to your local computer.
On your local computer, do:
scp - [user_name]@login.hpc.arrhenius.naiss.se:/home/[user_name]/[folder_name] [local_folder_destination]
For example:
Where . means 'the folder where I am now'.
Source repository