Skip to content
NAISS Logo
Allocations Support Training Software naiss.se

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.

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).
  • scp has the similar arguments as for the linux copy function cp.
  • sftp is more versatile with more file management capabilities. Optional lesson
  • rsync is 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 for rm -i that asks if you really want to remove the file.
  • rsync may 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:

scp [file_name] [user_name]@login.hpc.arrhenius.naiss.se:/home/[user_name]/

For example:

scp my_file.txt svante@login.hpc.arrhenius.naiss.se:/home/svante/

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:

scp svante@login.hpc.arrhenius.naiss.se:/home/svante/my_file.txt .

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:

scp -r [folder_name] [user_name]@login.hpc.arrhenius.naiss.se:/home/[user_name]/

For example:

scp -r my_folder svante@login.hpc.arrhenius.naiss.se:/home/svante/

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:

scp -r svante@login.hpc.arrhenius.naiss.se:/home/svante/my_folder .

Where . means 'the folder where I am now'.