I've received a file called date.tar.gz. How do I open a tar.gz file under Linux or Unix like operating systems?
.tar.gz file is nothing but an archive. It is a file that acts as a container for other files. An archive can contain many files, folders, and subfolders, usually in compressed form.
Say hi to tar command line tool
You need to use the tar command which can create and manipulate archive files in .tar.gz under Unix like operating systems. Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following to open and extract a .tar.gz file:
tar -zxvf data.tar.gz
Where,
- -z : Uncompress the resulting archive with gzip command.
- -x : Extract to disk from the archive.
- -v : Produce verbose output i.e. show progress and file names while extracting files.
- -f data.tar.gz : Read the archive from the specified file called data.tar.gz.
By defaults files will be extracted into the current directory. To change the directory use -C option. In this example, extract files in /data/projects directory:
tar -zxvf data.tar.gz -C /data/projects
To view a detailed table of contents (list all files) for this archive, enter:
tar -tzvf data.tar.gz
Sample outputs:
-rw-r--r-- root/root 2981 2012-01-11 03:24 etc/adduser.conf -rw-r--r-- root/root 6302 2012-01-11 04:46 etc/ca-certificates.conf -rw-r--r-- root/root 2969 2011-01-31 00:14 etc/debconf.conf -rw-r--r-- root/root 600 2010-11-22 02:46 etc/deluser.conf -rw-r--r-- root/root 346 2010-12-05 20:23 etc/discover-modprobe.conf -rw-r--r-- root/root 8661 2011-12-31 21:45 etc/ffserver.conf -rw-r--r-- root/root 2940 2011-01-24 00:26 etc/gai.conf -rw-r--r-- root/root 899 2009-08-31 12:51 etc/gssapi_mech.conf -rw-r--r-- root/root 4794 2010-09-30 17:44 etc/hdparm.conf -rw-r--r-- root/root 9 2006-08-07 22:44 etc/host.conf -rw-r--r-- root/root 145 2010-08-26 08:09 etc/idmapd.conf -rw-r--r-- root/root 882 2010-05-07 15:33 etc/insserv.conf -rw-r--r-- root/root 31393 2007-10-21 13:50 etc/jwhois.conf -rw-r--r-- root/root 144 2012-01-11 04:55 etc/kernel-img.conf -rw-r--r-- root/root 1180 2009-04-24 02:55 etc/kerneloops.conf -rw-r--r-- root/root 34 2012-01-11 03:23 etc/ld.so.conf -rw-r--r-- root/root 3587 2010-04-10 03:54 etc/lftp.conf -rw-r--r-- root/root 26 2010-08-14 20:40 etc/libao.conf -rw-r--r-- root/root 191 2010-06-18 19:54 etc/libaudit.conf -rw-r--r-- root/root 599 2009-02-19 17:27 etc/logrotate.conf -rw-r--r-- root/root 15752 2009-07-25 20:43 etc/ltrace.conf -rw-r--r-- root/root 801 2011-06-20 08:24 etc/mke2fs.conf -rw-r--r-- root/root 624 2010-02-15 10:09 etc/mtools.conf -rw-r--r-- root/root 513 2012-01-11 04:53 etc/nsswitch.conf -rw-r--r-- root/root 552 2010-10-19 22:22 etc/pam.conf -rw-r--r-- root/root 7649 2012-01-11 04:53 etc/pnm2ppa.conf -rw-r--r-- root/root 2724 2010-08-08 01:33 etc/reportbug.conf -rwxr-xr-x root/root 332 2012-05-05 14:14 etc/resolv.conf -rw-r--r-- root/root 2573 2012-04-06 00:00 etc/rsyslog.conf -rw-r--r-- root/root 8596 2010-05-26 23:02 etc/sensors3.conf -rw-r--r-- root/root 7093 2010-12-26 17:23 etc/smartd.conf -rw-r--r-- root/root 2089 2012-02-26 03:35 etc/sysctl.conf -rw-r--r-- root/root 645 2009-03-25 16:35 etc/ts.conf -rw-r--r-- root/root 1260 2008-05-30 11:52 etc/ucf.conf -rw-r--r-- root/root 274 2009-11-04 03:46 etc/updatedb.conf -rw-r--r-- root/root 571 2010-11-11 20:13 etc/usb_modeswitch.conf
file-roller: GUI tool
You can use the Archive Manager GUI application to create, view, modify, or unpack an archive. You can start Archive Manager by clicking on
Applications menu > Choose Accessories > Archive Manager
To open an archive:
- Choose File.
- Open to display the Open dialog.
- Select the archive that you want to open.
- Click Open.
Once opened you can view or extract files. To select all files in an archive, choose Edit > Select All or press Ctrl+A. To extract files from an open archive:
Select the files that you want to extract.
- Choose Archive > Extract to display the Extract dialog. Alternatively click Extract in the toolbar.
- Select the folder where Archive Manager extracts the files.
- Click Extract.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop
















{ 2 comments… read them below or add one }
can i access n edit the complicated structured tar files
Get the Midnight commander:
sudo apt-get install mc