Last active
May 8, 2025 18:12
-
-
Save Raboo/9b23c55d454601e2b46d8d88d2e12141 to your computer and use it in GitHub Desktop.
Command line snippets
This file contains hidden or 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
# should be faster than rsync | |
# 1. receiver | |
nc -l 6001 | tar xvpP | |
# 2. sender | |
tar cPf - /etc/profile.d | nc ${HOST} 6001 |
This file contains hidden or 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
# Here is an example using the debian/ubuntu version of nc (using named pipe as described in nc(1) because nc doesn’t have -e or -c) | |
# receiver | |
rm -f /tmp/rsyncpipe && mkfifo /tmp/rsyncpipe && cat /tmp/rsyncpipe | (read cmd && eval "$cmd") | nc -l 1243 >/tmp/rsyncpipe | |
# sender | |
rsync --progress --rsh='bash -c "(echo ""$@""; cat) | nc $0 1243"' <file> 10.142.0.119:<file> | |
# Unfortunately, due to the fifo, rsync stays open even after the transfer is complete, so you have to Ctrl+C on both sides when it looks like it’s done (when --progress reports to-check=0/n). |
This file contains hidden or 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
# favorite rsync syntax, optimized for speed. | |
# rsync-path/sudo part is if you don't have read permissions, requires passwordless sudo I would assume. | |
# can use following script to find fasted ssh cipher https://gist.github.com/dlenski/e42a08fa27e97b0dbb0c0024c99a8bc4 | |
rsync -rlptgoW --inplace --numeric-ids --info=progress2 -e "ssh -A -T -o Compression=no -x -c [email protected]" --rsync-path="sudo rsync" root@hostname:/remote_src/ /local_dst |
This file contains hidden or 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
# should be faster than rsync | |
# 1. receiver | |
socat TCP-LISTEN:6001 - | tar xvpP | |
# 2. sender | |
tar cPf - /etc/profile.d | socat TCP:${HOST}:6001,sndbuf=33554432 - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment