reddit / emacs

A lifehack for your shell (link in comments)

xenodium · 2022-07-16 13:43
xenodium · 2022-07-16 13:44
tl;dr Today, `unzip` comes to mind way faster than any unarchiving tool. Alias it to atool (and never think about it again). [https://xenodium.com/a-lifehack-for-your-shell](https://xenodium.com/a-lifehack-for-your-shell) update: there's also a bonus for `dired`.
mickeyp · 2022-07-16 14:12
Typing `Z` in dired will uncompress or compress the marked files. That's how I generally do it if I need to do it from inside Emacs.
xenodium · 2022-07-16 14:37
Ah yeah Z `dired-do-compress` is pretty nice until attempting a less popular archive format (say .rar) and doesn't do the right thing. Also, being synchronous, it blocks Emacs for larger archives.
tman5400 · 2022-07-17 04:11
So if I'm getting this correct, this basically allows you to unarchive any archive type with one command? If so, I have the same functionality with a custom bash function. Something like this: ``` case $1 in (*.tar.bz2) tar xjf $1 ;; (*.tar.gz) tar xzf $1 ;; (*.bz2) bunzip2 $1 ;; (*.rar) unrar x $1 ;; (*.gz) gunzip $1 ;; (*.tar) tar xf $1 ;; (*.tbz2) tar xjf $1 ;; (*.tgz) tar xzf $1 ;; (*.zip) unzip $1 ;; (*.Z) uncompress $1 ;; (*.7z) 7z x $1 ;; (*.deb) ar x $1 ;; (*.tar.xz) tar xf $1 ;; (*.tar.zst) unzstd $1 ;; ... ```
xenodium · 2022-07-17 08:54
Yep. This works too. I had a similar function [https://github.com/xenodium/dotsies/commit/c939802f64e4d97800f350b5c88ce83e4da40bc1](https://github.com/xenodium/dotsies/commit/c939802f64e4d97800f350b5c88ce83e4da40bc1) but now delegating to atool instead.
Tall_Leadership5749 · 2022-07-18 06:40
I use https://github.com/mitsuhiko/unp for years
xenodium · 2022-07-18 08:23
Ah nice. I only just learned about it recently in lobste.rs comments https://lobste.rs/s/qaimmg/lifehack_for_your_shell Added a “atool alternatives” section to https://xenodium.com/a-lifehack-for-your-shell