Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have some snappy files that I'd like to be able to compress/decompress on the command line. I didn't see any obvious tools, is there's something standard that people use for snappy?

share|improve this question

closed as off-topic by Braiam, LnxSlck, mniess, guntbert, BuZZ-dEE May 14 at 21:01

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – mniess, guntbert, BuZZ-dEE
If this question can be reworded to fit the rules in the help center, please edit the question.

2  
To be honest, I don't think that this is an Ubuntu specific question. You should rather ask the authors of this tool via e-mail or no their forum –  Melon Dec 14 '12 at 10:19

2 Answers 2

up vote 1 down vote accepted

Here's a gem that I found long back on the arch forums, before you use it you should have 7zip and unrar or other tools to handle the formats you need to extract.

# File extractor
# usage: extract <file>
extract ()
{
  if [ -f $1 ] ; then
    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      ;;
      *.snz)       snunzip $1      ;;
      *)           echo "'$1' cannot be extracted via extract()" ;;
    esac
  else
    echo "'$1' is not a valid file"
  fi
}

To use it, you must add this to your .bash_profile or .profile after that is done you can use extract to decompress all sort of archives from the command line. The syntax is extract name-of-archive

You can use it with snappy too, you need to install this however before it'll work.

share|improve this answer
    
The question is about a specific file format, snappy, which your answer doesn't mention. –  sierrasdetandil Dec 14 '12 at 19:08
    
@sierrasdetandil have added the details to make it work with snappy too, the objective of my answer was to share a tip that I personally dind very useful and can be extended to virtually any file format. –  nikhil Dec 15 '12 at 11:09
    
I understand, I was just pointing out that it didn't answer the question. I've removed my downvote now that it does. –  sierrasdetandil Dec 15 '12 at 18:38
    
@sierrasdetandil Fair point! –  nikhil Dec 15 '12 at 23:12

This is exactly feature request #34 in the issue tracker of Snappy. See the comments of December 3 for a Python command line version available on Github.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.