4 ms·
> The obvious way to do it is: > $ gzip -c access.log > access.log.gz Is it?
by emptiestplace 2y ago
> The obvious way to do it is:
> $ gzip -c access.log > access.log.gz
Is it?
- zoky 2y agoI mean, if you’re the type of person who considers using tar and nc to be the obvious way to transfer a directory between two computers…
- vbezhenar 2y agoI might be weird, but for me the most obvious way to transfer a small directory is to do tar -cz dir | base64 Copy output into clipboard base64 -d | tar -xz Paste from clipboard into input Works flawlessly to move configs and stuff between servers. I actually love the blend between terminal and GUI. For this example I'm using CLI tools to produce text and I'm using GUI to scroll, select and copy&paste the text between two terminal tabs. I wish developers put more emphasis on empowering terminal with GUI capabilities.
- zoky 2y agoUnder certain circumstances, like where machines are not directly accessible to each other and you’re only able to connect by Remote Desktop or something, that’s not actually bad way to do that. But for machines that are on the same network, using a weird invocation of tar and nc instead of just using, say, rsync is an odd choice. And for machines connected to each other over the Internet, it’s positively insane.
- Towaway69 2y agoOn Mac you can use pbcopy to copy something your pasteboard aka clipboard. So the first command becomes: tar -cz dir | base64 | pbcopy
- zoky 2y agoAnd of course you can use pbpaste for the inverse. Doesn’t work over SSH though, which is almost certainly how you’d be using this.
- Towaway69 2y agoTrue that unless ssh tunnels the pasteboard nowadays ;) GP was doing this using GUI and TUI so it's a case of having two terminals open to two different machines I assume.
- zoky 2y ago> GP was doing this using GUI and TUI so it's a case of having two terminals open to two different machines I assume. Yeah, but that’s exactly the case where it won’t work. pbcopy and pbpaste run locally, so if you’re connected to a remote Mac they won’t work properly (they will just cut/paste to the remote machine’s local pasteboard), and if you’re connected to a non-Mac the commands won’t exist at all. The only case where they would work is, say, connecting from one Mac to another via something like VNC that does do pasteboard sharing, and you’re trying to copy a file structure from a remote system to a local one. If you’ve got two terminal windows open to two different machines, you’ll have to cut and paste manually.