Archive for the ‘Bash’ Category

Faster File Copy Using Tar and SSH

Thursday, October 2nd, 2008

How to quickly copy a file or directory over SSH using tar:

tar -cf - myfile | ssh target_host tar -xf -

If you want to change the target directory, use this:

tar -cf - myfile | ssh target_host “cd /target_dir; tar -xf -”

Copying directory trees with tar pipe tar

Friday, September 5th, 2008

# tar cf - source_dir | ( cd target_dir && tar xBf - )

How to get the directory location of a shell script

Wednesday, March 26th, 2008
dirname=`dirname $0`