Created
July 23, 2017 13:41
-
-
Save mondwan/13c9c92e89a326f2d914a1a082a541f8 to your computer and use it in GitHub Desktop.
cp and scp and tar and symbolic links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy with links | |
cp -r src/* dst/ | |
# Copy without links but files | |
cp -rL src/* dst/ | |
# Scp to the remote side without links but files | |
# Remember to replace `localhost` and `pwd` with your own variables | |
scp -r src/* localhost:`pwd`/dst | |
# Tar scp combo to get links | |
tar cf src.tar.gz src/ | |
scp src.tar.gz localhost:`pwd`/subdir/ | |
# tar scp combo on the fly | |
# Open a new terminal for the destination host and run following command | |
# Use NC to listen on any port (EG: 12345) and untar it on the fly | |
nc -l 12345 | tar xf - | |
# Open another new terminal for the source host and run following command | |
# Tar the entire folder and send them through netcat | |
# Remember to replace `localhost` and `pwd` with your own variables | |
tar cf - src/ | nc localhost 12345 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment