Tuesday, August 17, 2010

zip(or tar) and copy to remote machine in one command

Below is the command


tar cfpsP - DIRNAME OR FILENAME | ssh DEST_IP -C "cd DEST_DIR ; tar xf - "

If someone wants to do gunzip on the tar,then command would be

tar zcfpsP - DIRNAME OR FILENAME | ssh DEST_IP -C "cd DEST_DIR ; tar zxf - "