Skip to main content

How to Extract/Uncompress/Unarchive file in linux.

This is a no-frills Linux command line guide/cheat sheet that will help you extract or unarchive or uncompress just about any file that you’re bound to come across. If you’d like to have more options, read the man pages! Also, the opposite to this guide about creating/compressing/archiving files in Linux can be found here.
Preliminary:
Most compressed or archived files that you’ll come across already have built-in support under popular distributions (Ubuntu, Fedora, Suse, etc…), but some of them aren’t. I would recommend installing this group of packages using apt-get, yum, or an equivalent before using this guide (unless of course you already know what you need):

[root@localhost]# yum install -y unzip p7zip unrar bzip2 gzip lzma

1. *.tar
[root@localhost]# tar xvf filename.tar

2. *.tar.gz
[root@localhost]# tar xzvf filename.tar.gz

3. *.tgz
[root@localhost]# tar xvzf filename.tgz

4. *.tar.bz2 (Or maybe we mean *.tar.gz2)
[root@localhost]# tar xjvf filename.tar.bz2

5. *.tar.bz
[root@localhost]# tar xjvf filename.tar.bz

6. *.tbz
[root@localhost]# tar xjvf filename.tbz

7. *.tar.Z
[root@localhost]# zcat file.tar.Z | tar xvf -

8. *.tar.xz
[root@localhost]# lzcat filename.tar.xz | tar xvf -

9. *.gz
[root@localhost]# gunzip filename.gz

10. *.gz2 (Or maybe we mean *.bz2. It's the same way like untar *.bz2 above)

11. *.bz
[root@localhost]# bunzip filename.bz

12. *.bz2
[root@localhost]# bunzip2 filename.bz2

13. *.Z
[root@localhost]# uncompress filename.Z

14. *.xz
[root@localhost]# unlzma filename.xz

15. *.zip
[root@localhost]# unzip filename.zip

16. *.7z
[root@localhost]# 7z x filename.7z

17. *.rar
[root@localhost]# unrar x filename.rar

18 *.dmg
This isn’t a file that can be ‘extracted’ but you can mount and save the files using:
[root@localhost]# mkdir /mnt/source
[root@localhost]# mount -o loop -t hfs filename.dmg /mnt/source
[root@localhost]# cp /mnt/source/* /home/username/destination/

19. *.img, *.dd
These aren’t files that can be ‘extracted’ but you can mount and save the files using:
[root@localhost]# mkdir /mnt/source
[root@localhost]# mount -o loop -t iso9660 filename.img /mnt/source
[root@localhost]# cp /mnt/source/* /home/username/destination/

NOTES: "*" means to your filename which will to unpack. Example "testsource-12.1.0-1.tar.gz".

Comments

Popular posts from this blog

Improving (network) I/O performance

Introduction The reason for the current work is to analyze different methods for efficent delivery of network events from kernel mode to user mode. Five methods are examined, poll() that has been chosen as the better old-style method, standard /dev/poll interface, standard RT signals, RT signals with one-sig-per-fd patch and a new /dev/epoll that uses a quite different notification method. This work is composed by : 1) the new /dev/epoll kernel patch 2) the /dev/poll patch from Provos-Lever modified to work with 2.4.6 3) the HTTP server 4) the deadconn(tm) tool to create "dead" connections As a measurement tool httperf has been chosen coz, even if not perfect, it offers a quite sufficent number of loading options. The new /dev/epoll kernel patch The patch is quite simple and it adds notification callbacks to the 'struct file' data structure : ******* include/linux/fs.h struct file { ... /* file callback list */ rwlock_t f_cblo...
Did you ever got this error message, "Could not start the "application" Service service on Local Computer. Error 1069 : The Service did not start due to a logon failure.” I ever got this message when i try to start an application on windows server 2003 or NT. I try to retype the password in "services" menu. But, it still did not work. Now, i check the permission on file that refer to path that show in "services". And i set it to full access for everyone. And then, i back to the "services" menu again, and starting this. And it's working now. This issue show, it cannot to access the file on windows services. It needs to make sure that the files is able to execute. So if you got this message, try to register in Control Panel > Administrative > Services. And Type the password and start it after you put your password.