(mail)
(mail)
(mail)

CIS241

System-Level Programming and Utilities

File Transfers

Erik Fredericks, frederer@gvsu.edu
Fall 2025

Based on material provided by Erin Carrier, Austin Ferguson, and Katherine Bowers

CIS241 | Fredericks | F25 | 5-file-transfer

Lots of options!

Ones we'll talk about:

  • scp
  • sftp
  • rsync
CIS241 | Fredericks | F25 | 5-file-transfer
(scp)

SCP

CIS241 | Fredericks | F25 | 5-file-transfer

SCP

Remember ssh - Secure SHell

scp - Secure CoPy

Recall - copying files locally: cp source destination

scp is similar, but works remotely!

Information required:

  • Host we are copying to/from
  • Username we'll use on that host
CIS241 | Fredericks | F25 | 5-file-transfer

SCP

scp [[user@]src_host:]src_path [[user@]dest_host:]dest_path

  • Note that items in [] can sometimes be omitted
  • Example, transfer local file to EOS
    • scp local_file username@eos01.cis.gvsu.edu:~/my_dir
CIS241 | Fredericks | F25 | 5-file-transfer

SCP directedness

scp doesn’t care which systems we are moving files to/from

The last example copied a local file to the server

  • scp local_file username@eos01.cis.gvsu.edu:~/my_dir

What if we want to copy a file from server to laptop?

  • scp username@eos01.cis.gvsu.edu:~/my_dir/file .

Why stop there? We could also copy files directly from one server to another, all from our local machine!

CIS241 | Fredericks | F25 | 5-file-transfer

SFTP

Secure File Transfer Protocol

sftp username@address

Common commands:

  • get file

  • put file

  • Limited subset of terminal commands (e.g., ls)

  • Can interact with local (your computer) terminal using ! in front

    • e.g., !ls lists the files in your current directory
CIS241 | Fredericks | F25 | 5-file-transfer
(sftp cheatsheet)

SFTP

CIS241 | Fredericks | F25 | 5-file-transfer

Which one?

  • SCP is older, SFTP is newer

  • Both get the job done fine

  • However

    • SFTP gives you a bit more
      • Such as resumable transfers, file system access, etc.
  • Both still better than FTP!

    • Why?
CIS241 | Fredericks | F25 | 5-file-transfer

RSYNC

rsync is like a fancier scp

It checks to make sure there are differences between the files

  • If there are differences, it only copies them, not the whole file

Command format is very similar to scp:

  • rsync [[user@]src_host:]src_path [[user@]dest_host:]dest_path

Note that rsync has a ton of options!

  • Automatic compression
  • Progress bars
  • Partial files (in case of restarts)
  • Much more!

top-right (rsync)

.

rsync

https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories

.