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.
$which rar
Will tell you where rar is located.
rar
does not work, right? (Well, unrar
, for this question.)
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
}
which unrar
would have told you which program would be executed. (And are you sure you would needsudo
to run the command? Don't usesudo
for everything you do!)