I feel pondering hard Questions leads to more knowledge than just seeking answers. Here I'll try to strike a balance between then Questions I've had and the potentially correct Solutions to match.
Showing posts with label copying. Show all posts
Showing posts with label copying. Show all posts

Thursday, November 19, 2015

Tar b64 Copy Pasta

Lets say you might want to copy a few different files(maybe with non-matching names in a directory) from one host to another. scp might take a few commands, but if you can squeeze them all into a small tarball this trick I learned from an old mentor is pretty handy.

Compress and tarball files, and pipe the output into base64 which will get dumped to your terminal.
tar -czf - ./filesyouwant* | base64

Copy only the base64 output characters into your host's clipboard.

cat | base64 -d | tar -xzf -
Execute this command to start cat waiting for the character input. Then paste the base64 previously copied.
Once all the base64 has finished pasting, hit Enter, then Ctrl^d to release cat. The pasted base64 will get decoded and tar will decompress the binary data into files of your current working directory!