3 ms·
Not sure if it's common across all tar implementations, but you can use -C to let GNU tar change directories before performing any operation. So this command is
by tremon 6y ago
Not sure if it's common across all tar implementations, but you can use -C to let GNU tar change directories before performing any operation. So this command is equivalent:
$ tar -cC /source/dir . | ssh rhost tar -xvC /dest/dir
(I also left out -f - because it's the default)
- tyingq 6y agoHelpful, thanks. Old habits die hard. Tar wasn't always GNU tar back when this became useful to me.
- wahern 6y agoFWIW, while tar isn't even a POSIX command, -C is supported by bsdtar[1] (including macOS), AIX tar (confirmed AIX 7.1), and Solaris tar (confirmed Solaris 11.4). Argument ordering and bundling is really funky on AIX and Solaris, though, especially for extraction. [1] Seems like everybody except OpenBSD has migrated to libarchive's bsdtar, but OpenBSD also supports -C.
- deleted 6y ago[deleted]