1

I installed rar, but I want to know where it is stored?

I did:

sudo apt-get rar

it installed it, but typing : sudo unrar file.rar doesn't work, says it doesn't know what the command is.

3
  • as you can see from myanswer below the syntax for using rar is "rar x filename". You cannot use unrar without installing it first. The syntax for unrar would be "unrar e filename"
    – tapan
    Jun 13, 2010 at 17:54
  • 4
    And as an aside, if the command would have worked, then typing which unrar would have told you which program would be executed. (And are you sure you would need sudo to run the command? Don't use sudo for everything you do!)
    – Arjan
    Jun 13, 2010 at 18:18
  • @arjan: +1 for the 'sudo' advice
    – dag729
    Jun 13, 2010 at 18:49

2 Answers 2

8
$which rar

Will tell you where rar is located.

2
  • ...but not if running rar does not work, right? (Well, unrar, for this question.)
    – Arjan
    Jun 13, 2010 at 18:47
  • I see that tapan already answered - unrar is a different program
    – Abhinav
    Jun 13, 2010 at 18:56
5

unrar is a different program from rar. You'll have to install that too. Mostly all your programs will be stored in /usr/bin or /usr/sbin . You can add this function to your .bashrc file and then just use the command extract to extract any archive :

extract () {
     if [ -f $1 ] ; then
         case $1 in
             *.tar.bz2)   tar xjf $1        ;;
             *.tar.gz)    tar xzf $1     ;;
             *.bz2)       bunzip2 $1       ;;
             *.rar)       rar 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    ;;
             *)           echo "'$1' cannot be extracted via extract()" ;;
         esac
     else
         echo "'$1' is not a valid file"
     fi
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .