Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Now press Enter to get the command going. Repeat for the 2nd link. Check that you now see the two files (ls), or tree tree $SCRATCH to see your Scratch directory hierarchy:

...

  • -a means "archive mode", which implies the following options (and a few others)
    • -p – preserve file permissions
    • -t – preserve file times
    • -l – copy symbolic links as links
    • -rrecursively copy sub-directories
  • -v means verbose
  • -W means transfer Whole file only
    • Normally the rsync algorithm compares the contents of files that need to be copied and only transfers the different parts.
    • For large files and binary files, figuring out what has changed (diff-ing) can take more time than just copying the whole file.
    • The -W option disables file content comparisons (skips diff-ing).
      • Files are only copied if their modification date is more recent or the file size is different

Since these are all single-character options, they can be combined after one option prefix dash ( - ). You could also use options -ptlrvW, separately, instead of using -a for "archive mode".

Tip
titleAlways add a trailing slash ( / ) after directory names

The trailing slash ( / ) on the source and destination directories are very important for rsyncand for other Linux copy commands also!

rsync will create the last directory level for you, but earlier levels must already exist.

Let's copy a directory using rsync. We'll also add the -P option to show Progress as the copy progresses.

Code Block
languagebash
titlersync (local directory)
mkdir -p $SCRATCH/data
cds
rsync -avW -avrWP $CORENGS/custom_tracks/ data/custom_tracks/

...

Tip

The bash shell has several convenient line editing features:

  • use the Up arrow to scroll back through the command line history; Down arrow goes forward
  • use Ctrl-a to move the cursor to the beginning start of a line; Ctrl-e to the end end
  • Ctrl-k ("kill") to delete all text on your command line after the cursor
  • Ctrl-y ("yank") to copy the last killed text to where the cursor is

Once the cursor is positioned where you want it:

  • Just type in any additional text you want
  • To delete text after the cursor, use:
    • Delete key on Windows
    • Function-Delete keys on Macintosh
  • To delete text before the cursor, use:
    • Backspace key on Windows
    • Delete key on Macintosh

(Read more about Command line history and editing)

...

Code Block
titlesingle remote file copy with scp
cat $CORENGS/tacc/dragonfly_access.txt
cds
mkdir -p data/test2
scp -p corengstools@dragonfly.icmb.utexas.edu:~/custom_tracks/progeria_ctcf.vcf.gz ./data/test2/
tree ./data/test2

Notes:

  • The 1st time you access a new host the SSH security prompt will appear
  • You will be prompted for your remote host password
    • for security reasons characters will not be echoed
  • The  -r recursive argument works for scp also, just like for cp
  • The  -p argument says to preserve the file's last modification time
    • otherwise the last modification time of the local copy will be when the copy was done

...