News for hackers. Stuff that matters.
Re:Show HN: Extract it – Because nobody can remember tar com... by kazinator on Thursday September 10, 2015 @08:31PM (#10201364)
It's a nice web gadget. However, I just go by this handy table, which is on a yellow stickie on my monitor:

  NAME             MODERN GNU TAR COMMAND
  file.tar.gz      tar xf file.tar.gz
  file.tar.bz      tar xf file.tar.bz
  file.tar.bz2     tar xf file.tar.bz2
  file.tar         tar xf file.tar
  file.tgz         tar xf file.tgz (missing from web gadget!)
  file.abcdef      tar xv file.abcdf (*)
  ---
  * If file.abcdf is actually any of the preceding formats;
    i.e. GNU Tar doesn't just go by the suffix!
Nobody memorizes these, and I wouldn't want to turn into a nobody, right?

By the way, if you actually do need a command which performs a pattern match on a file name and dispatches some other command, why would you go through a web browser? You'd want this in your shell as a function:

  $ dtrt x.blorch.zonk.bloop # "do the right thing"
Hello, we have "case"

  case "$file" in
  -* | --* ) echo "oops, $file looks like an option!" ;;
  *.zip ) unzip "$file" ;;
  *.rar ) ... ;;
  *.tar.* | *.tgz | *.tar ) tar xf "$file" ;;
  ...
  esac

There are no comments on this comment yet.