12 ms·
OSX: tar -xf some.tar.xz (WORKS!) Linux: tar -xf some.tar.xz (WORKS!) I had no idea tar could autodetect compression when extracting. (I wonder if this is
by samstokes 11y ago
OSX: tar -xf some.tar.xz (WORKS!)
Linux: tar -xf some.tar.xz (WORKS!)
I had no idea tar could autodetect compression when extracting. (I wonder if this is GNU tar only, or whether the OSX default tar can do it too?) I've been typing `tar zx` or `tar jx` for too long.
- LeoPanthera 11y agobsdtar (the version in OS X) can do it too. Older versions of OS X used to come with "gnutar" as a separate binary, but not recent versions.
- x0 11y agoWow, really? Honestly I've never used the z or j flags, I could not even tell you what they do. I use `tar caf whatever.(txz|tgz|tar.lz|tar.lzo) /path/to/files` to create, and just `tar xf whatever` to extract.
- teach 11y agoSome of us have been using Unix tools a very long time. For example, I'm pretty sure I started using tar and gzip in 1995.
- feld 11y agoI think it's libarchive used by BSD tar that allows this auto detection as well
- jakschu 11y agoBest thing about libarchive/bsdtar is, it also handles zip, rar, cpio, iso files and many others. So basically bsdtar xf is what I'm using to extract almost every archive.
- pdkl95 11y agoI highly recommend using atool[1], and never worrying about extracting archives again. It's a wrapper around basically every compression/archive tool in remotely common use. Bonus: it decompresses to a safely-named subdirectory, but moves the contents of that subdirectory back to the current directory if the archive contained exactly one file. Highly convenient without any risk of accidentally expanding 1000 files into the current directory. After creating this macro, I've basically never had to care about how to decompress/unarchive anything. # 'x' for 'eXpand' alias xx='command atool -x' # use % cd $UNPACK_DIR # (optional) (can be the PARENT dir) % xx foo.zip # or .tar.{gz,xz} or whatever foo.zip: extracted to `foo' (multiple files in root) % cd foo/ % ls | wc -l 3 atool actually has many other useful features, but it's worth it just for the extractor. [1] http://www.nongnu.org/atool/ http://www.nongnu.org/atool/
- chx 11y agoLooks awesome by description but last release is from 2012 which makes me worried slightly.
- pdkl95 11y agoOld doesn't mean bad. Sometimes, it means "finished". About the only thing that a small would need to be updated at this point is support for a new compressor. (that 2012 release mainly added suppport for plzip)
- lqdc13 11y agoThere are usually issues in compatibility between linux zip utility and the mac one. Has to do with zip not being backward compatible. How does atool deal with cases where there are two versions of the same extractor?
- pdkl95 11y agoI'm not familiar with that issue, but you can set the path to any extractor in /etc/atool.conf or ~/.atoolrc # ~/.atoolrc path_zip /path/to/preferred/bin/zip See atool(1) for details. http://linux.die.net/man/1/atool http://linux.die.net/man/1/atool As far as I know, different zip formats are not auto-detected. However, it does (optionally) use file(1) to detect the file format, which can be overridden with the 'path_file' option, so a hack may be possible?
- vbezhenar 11y agoFor OS X and macports I use p7zip package which intalls 7z command. It understand .zip, .rar, of course .7z and probably other formats. I wrote simple Automator script to use that command from Finder and it works just fine (actually .zip and .tar.gz formats are supported by OS X archive tool, but .rar is not and I often have to deal with that format).