views:

90

answers:

3

Hello everybody! I use "file-roller" to manage with archieves on my Ubuntu. But it fails on running without user interface(just teminal). The error is shown below.

** (file-roller:5453): CRITICAL **: Failed to parse arguments: Cannot open display: 

How can I prevent file-roller from using GUI or can you recommend me any other archieve manager I can use from terminal. It would be perfect, if this manager can handle as much formats as it is possible.

+1  A: 

p7zip, unrar, gzip, tar and bzip2 are some popular archivers. For example, to compress a folder into gzipped tar, use the command:

tar cvpzf FILENAME DIRECTORIES...

Delan Azabani
+1  A: 

If you put this in your ~/.bashrc :

# Thanks to rezza at Arch Linux 
op () {
     if [ -f $1 ] ; then
        case $1 in
                *.tar.bz2)   tar xvjf $1 ;;
                *.tar.gz)    tar xvzf $1 ;;
                *.bz2)       bunzip2 $1 ;;
                *.rar)       unrar x $1 ;;
                *.gz)        gunzip $1 ;;
                *.tar)       tar xvf $1 ;;
                *.tbz2)      tar xvjf $1 ;;
                *.tgz)       tar xvzf $1 ;;
                *.zip)       unzip $1 ;;
                *.Z)         uncompress $1 ;;
                *.7z)        7z x $1 ;;
                *)           xdg-open $1 ;;
        esac
     else
        echo "'$1' is not a valid file"
     fi
}

then you can open most archive files from the command-line with

op archivefile

If this does not work, then run

file archivefile

and post the output. We may be able to then tell you the right command for that kind of file.

PS. You may have to close the terminal and open a new one to make the change to ~/.bashrc effective.

unutbu
Isn't there a standart util to do this?
Denis
@Denis, sure, there could be a standard util, though I don't know of one. What I suggest is not that hard, and is in line with the style of customization many people do with bash.
unutbu
Ok as you see I am new to Ubuntu, bash, .. I am not against using hand written scripts, I just wonder how it will handle options?? For example destination folder. And what about packaging, I mean, building archieves. I marked two answers as useful and great thx for your help! but I still wish anybody can provide a solution similar to file-roller, but with ability to be run from terminal. If this question won't be answered for a long time I will mark this one as the right answer.
Denis
A: 

Have a look at Midnight Commander (mc)

Florian Diesch