LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Uncompressing Files in Linux (https://www.linuxquestions.org/questions/linux-software-2/uncompressing-files-in-linux-908763/)

silver_distro 10-18-2011 08:37 AM

Uncompressing Files in Linux
 
Is there a single Linux utility that can be used to uncompress files of common formats like .rar, .zip, .z, .gz, .tar, .bz2 etc. instead of different utilities for all of them?

Juako 10-18-2011 08:47 AM

The Gnome environment has file-roller, it's a GUI frontend for various archiving utilities. I don't know about CLI front-ends but I'd be surprised if there aren't a few around.

silver_distro 10-18-2011 09:05 AM

Could you please elaborate on the file-roller thing?
Actually, I need to uncompress a few file formats in my software. It runs on a linux server. So, I'd need a utility, like gunzip for .z files and uncompress for .gz files which can handle all the file formats all in one.

Juako 10-18-2011 09:31 AM

File-roller is a GUI program, you can compare its interface to that of "winzip" or similar graphical programs for dealing with compressed files, it's included by default in the Gnome desktop. What desktop do you use?

Cultist 10-18-2011 09:35 AM

KDE uses Ark, which is essentially the same thing

silver_distro 10-18-2011 12:58 PM

I am not sure if I am making myself clear. I don't need any GUI. I just need a command line utility (like gunzip) which could uncompress multiple file formats. Right now, I have to use separate utilities for each file format and I want to avoid that.

crts 10-18-2011 01:33 PM

Quote:

Originally Posted by silver_distro (Post 4501678)
Right now, I have to use separate utilities for each file format and I want to avoid that.

I am not sure if there is such a program for the CLI. You probably could write a shell script that will recognize the compression format and then choose the appropriate tool do decompress it.

Q: Does the machine that you need this for have a GUI, i.e. Gnome installed?
If yes, then you could use 'file-roller'.
Quote:

I don't need any GUI.
Seriously,
Code:

man file-roller
It actually can be called from the command-line and used for decompression without any further interaction:
Code:

$ file-roller -h /path/to/compressed/file        # extract in current directory
$ file-roller -e TARGET /path/to/compressed/file  # extract in TARGET directory directory

Compression, however, will pop up a window for confirmation.

David the H. 10-18-2011 03:11 PM

Two more options for you:

unp
unar (the package that provides it is called "unarchiver" or similar)

H_TeXMeX_H 10-19-2011 05:52 AM

7zip/p7zip can uncompress them all, although permissions for tar doesn't always work, so it's best to use the tar utility for that.

silver_distro 11-25-2011 03:53 AM

@crts...
Sorry for the delayed reply...but it is now that I finally managed to get the permissions to install file-roller on the server.
I gave the command as

file-roller -h test.gz

But it gave and error..

"cannot open display:
Run 'file-roller --help' to see a full list of available command line options."

I cannot open any GUI pop-up as this command will be coded in a script.
What should I do.?

@David
I could not find the rpm packages for unp or unar.
Can you help me with that?
I am using RedHat 5.3.

MTK358 11-25-2011 08:26 AM

Quote:

Originally Posted by silver_distro (Post 4533455)
I cannot open any GUI pop-up as this command will be coded in a script.

It was already said that file-roller is a GUI desktop application.

Mr. Alex 11-25-2011 08:45 AM

For extracting ZIP:
Code:

unzip file.zip
For extracting RAR:
Code:

unrar e file.zip
You should install "unzip" and "unrar" first.

H_TeXMeX_H 11-25-2011 10:09 AM

For extracting zip, rar, 7z, tar, gz, bz2, cpio, rpm, deb, and others:

Code:

7z x file.???

lithos 11-25-2011 11:33 AM

Quote:

Originally Posted by H_TeXMeX_H (Post 4533740)
Code:

7z x file.???

sorry, but sometimes you need to use
Code:

7za x ....
and you really could/should use/install p7zip package.

ruario 11-29-2011 02:19 PM

bsdtar, it won't do rar but will do all the others and several more (e.g. reading iso files)


All times are GMT -5. The time now is 09:10 AM.