UNIX Remote Access Commands

cURL (Command Line URL)

curl -I URL		[outputs header for file request response]
	-#			[progress bar instead of meter]
	-o <file>	[output to file]
	-O			[output using filename specified in URL]

rsync (Remote Sync)

http://rsync.samba.org/
Use rsync to back up a directory tree of files
A Tutorial on Using rsync
LifeHacker: Geek to Live: Mirror files across systems with rsync

Backup / Sync / Mirror

rsync -az --exclude '.DS_Store' --delete-excluded --delete --force

Update Target

Version

rsync -van . /Volumes/G-DRIVE\ MINI\ TRIPLE/DOS/
rsync -va /Volumes/AIRLINK-101/DOS/ /Volumes/G-DRIVE\ MINI\ TRIPLE/DOS/

rsync -aruvn --exclude '.DS_Store' /Volumes/G2-8GB/ /Users/runeimp/Desktop/Stuff/Mobile/G2/bzr/

rsync -aruv --exclude '.DS_Store' /Volumes/G2-8GB/ /Users/runeimp/Desktop/Stuff/Mobile/G2/bzr/
rsync -aruv --exclude '.DS_Store' /Volumes/G2-8GB/supersexyhotgirls1 /Users/runeimp/Desktop/Stuff/Mobile/G2/bzr/

rsync -aruvn --delete --exclude '__TEMP__' --exclude '__removed__' /Users/runeimp/Desktop/Stuff/Mobile/G2/bzr/Wallpapers /Volumes/G2-8GB/
rsync -aruv --delete --exclude '__TEMP__' --exclude '__removed__' /Users/runeimp/Desktop/Stuff/Mobile/G2/bzr/Wallpapers /Volumes/G2-8GB/

rsync -aru "/Volumes/G-DRIVE MINI TRIPLE/Mobile/G2/bzrx" "/Volumes/G-DRIVE MINI TRIPLE/Mobile/G2/bzr" && dl && rm -Rf bzrx && ll

rsync -ruz --exclude=.DS_Store "/Users/mgardner/Pictures/Babes" "/Volumes/G-DRIVE 2TB/Pictures/Babes"

rsync -avz --delete --exclude '.DS_Store' gina@192.168.3.2:/Users/gina/Documents/ d:/data/mac

rsync Switches

Short Long Description
-a --archive archive mode; same as -rlptgoD (no -H)
Ensures that symbolic links, devices, attributes, permissions, ownerships, etc. are preserved in the transfer.
-r --recursive recurse into directories
-l --links copy symlinks as symlinks
-p --perms preserve permissions
-t --times preserve times
-g --group preserve group
-o --owner preserve owner (super-user only)
-D   same as --devices @—specials@
  --devices preserve device files (super-user only)
  --specials preserve special files
     
-H --hard-links preserve hard links
-q --quiet suppress non-error messages
  --no-motd suppress daemon-mode MOTD (see caveat)
-n --dry-run show what would have been transferred
  --existing only update files that already exist on receiver
  --delete delete files that don’t exist on the sending side
-u --update skip files that are newer on the receiver
-v --verbose verbose messages
-z --compress compress file data during the transfer
  --exclude=PATTERN exclude files matching PATTERN
  --exclude-from=FILE read exclude patterns from FILE
  --include=PATTERN don’t exclude files matching PATTERN
  --include-from=FILE read include patterns from FILE
  --files-from=FILE read list of source-file names from FILE
  --delete-excluded also delete excluded files from dest dirs
  --force force deletion of dirs even if not empty
-C --cvs-exclude auto-ignore files in the same way CVS does
-f --filter=RULE add a file-filtering RULE
-F   same as --filter='dir-merge /.rsync-filter'
repeated: --filter='- .rsync-filter'
  --partial keep partially transferred files
  --partial-dir=DIR put a partially transferred file into DIR
-h --human-readable output numbers in a human-readable format
  --progress show progress during transfer
-P   same as --partial --progress
-i --itemize-changes output a change-summary for all updates
  --out-format=FORMAT output updates using the specified FORMAT
  --log-file=FILE log what we’re doing to the specified FILE
  --log-file-format=FMT log updates using the specified FMT
  --password-file=FILE read password from FILE
  --list-only list the files instead of copying them
  --bwlimit=KBPS limit I/O bandwidth; KBytes per second

rsync -C or —cvs-exclude

-C, --cvs-exclude

This is a useful shorthand for excluding a broad range of files that you often don’t want to transfer between systems. It uses a similar algorithm to CVS to determine if a file should be ignored.

The exclude list is initialized to exclude the following items (these initial items are marked as perishable — see the FILTER RULES section):

RCS SCCS CVS CVS.adm RCSLOG cvslog.* tags TAGS .make.state .nse_depinfo *~ #* .#* ,* _$* *$ *.old *.bak *.BAK *.orig *.rej .del-* *.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln core .svn/ .git/ .bzr

then, files listed in a $HOME/.cvsignore are added to the list and any files listed in the CVSIGNORE environment variable (all cvsignore names are delimited by whitespace).

Finally, any file is ignored if it is in the same directory as a .cvsignore file and matches one of the patterns listed therein. Unlike rsync’s filter/exclude files, these patterns are split on whitespace. See the cvs(1) manual for more information.

If you’re combining -C with your own --filter rules, you should note that these CVS excludes are appended at the end of your own rules, regardless of where the -C was placed on the command-line. This makes them a lower priority than any rules you specified explicitly. If you want to control where these CVS excludes get inserted into your filter rules, you should omit the -C as a command-line option and use a combination of --filter=:C and --filter=-C (either on your command-line or by putting the “:C” and “-C” rules into a filter file with your other rules). The first option turns on the per-directory scanning for the .cvsignore file. The second option does a one-time import of the CVS excludes mentioned above.

SCP (Secure CoPy)

Copy all .bz2 files in the current directory

scp *.bz2 mark@pitfiend.imptech.net:/home/mark/move

h3.	 Use the blowfish cipher for the transmission
scp -c blowfish ./*.jpg mark@box.imptech.net:/usr/backup

Recursive Copy

scp -r ./* mark@box.imptech.net:/usr/backup

Copy all files in the current directory

scp * mark@box.imptech.net:/usr/backup
scp ./* mark@box.imptech.net:/usr/backup

scp ./crossdomain.xml mark@box.imptech.net:/usr/vhosts/com/runeimp/www/crossdomain.xml