Differences between revisions 3 and 4
Deletions are marked like this. | Additions are marked like this. |
Line 17: | Line 17: |
The trailing slash on dir1 ensures that the *contents* of dir1 are transferred but not dir1 itself. Two other useful flags: | The trailing slash on dir1 ensures that the '''contents''' of dir1 are transferred but not dir1 itself. Two other useful flags: |
Line 31: | Line 31: |
|| option || Description || |
|| '''option''' || '''Description''' || |
UNIX commands and Notes
Summarize the size of a group of gz files:
ls -l *.gz | awk '{sum += $5} END {print sum}'
rsync
Remote and local file syncronization. Given two directories dir1 and dir2, you can synchronize the contents of dir2 to dir1 as follows:
rsync -a dir1/ dir2
The trailing slash on dir1 ensures that the contents of dir1 are transferred but not dir1 itself. Two other useful flags:
rsync -avn dir1/ dir2
v = verbose, n = dry-run
rsync to a remote machine
rsync -a local_dir username@remote_host:destination_directory
-P option will give you a progress bar, and in case of an interrupted transfer will also allow you to resume later.
other options
option |
Description |
--delete |
deletes files from destination that are not present locally (true sync) |
--include=pattern |
specify a pattern to include |
--exclude=pattern |
specify a pattern to exclude |