Extract tar.bz2 file or open tar.bz2 file using tar command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   The tar command can be use to open or extract tar.bz2 file.  The example below show step by step to extract the tar.bz2 file and then view inside the extract folder.

1.  The example below show the tar command with option xvjf is use to extract the tar.bz2 file..

# tar xvjf 

      x      <-- x = extract -->

       v     <-- v = verbose -->

        j    <-- j = bzip2 -->

         f   <-- f = file -->

extract tar tz2 file

[root@fedora ~]# tar xvjf sysreport-fedora.gnulinux.com3716.tar.bz2

sysreport-fedora.gnulinux.com3716/

sysreport-fedora.gnulinux.com3716/lsmod

sysreport-fedora.gnulinux.com3716/date

sysreport-fedora.gnulinux.com3716/lsof

sysreport-fedora.gnulinux.com3716/var/

sysreport-fedora.gnulinux.com3716/var/log/

sysreport-fedora.gnulinux.com3716/var/log/rpmpkgs

sysreport-fedora.gnulinux.com3716/var/log/messages

sysreport-fedora.gnulinux.com3716/var/log/maillog

sysreport-fedora.gnulinux.com3716/var/log/Xorg.0.log

sysreport-fedora.gnulinux.com3716/var/log/maillog-20080720

sysreport-fedora.gnulinux.com3716/var/log/messages-20080710

sysreport-fedora.gnulinux.com3716/var/log/httpd/

sysreport-fedora.gnulinux.com3716/var/log/httpd/modsec_debug.log

sysreport-fedora.gnulinux.com3716/var/log/httpd/modsec_audit.log

sysreport-fedora.gnulinux.com3716/var/log/dmesg

sysreport-fedora.gnulinux.com3716/var/log/boot.log

sysreport-fedora.gnulinux.com3716/var/log/maillog-20080714

sysreport-fedora.gnulinux.com3716/var/log/messages-20080720

sysreport-fedora.gnulinux.com3716/var/log/messages-20080714

sysreport-fedora.gnulinux.com3716/var/log/maillog-20080710

sysreport-fedora.gnulinux.com3716/var/log/messages-20080703

^C

[root@fedora ~]#

 

2.  Use the ll command to view the extracted tar.bz2 file / folder

list extracted bz2 file

[root@fedora ~]# ll

total 628

-rw------- 1 root root 3658 2008-05-20 08:26 anaconda-ks.cfg

drwxr-xr-x 6 root root 4096 2008-07-23 05:06 Desktop

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Documents

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Download

drwxr-xr-x 2 root root 4096 2008-05-20 15:53 fedora9

-rw-r--r-- 1 root root 72032 2008-05-20 08:25 install.log

-rw-r--r-- 1 root root 9766 2008-05-20 08:14 install.log.syslog

-rw------- 1 root root 5247 2008-07-08 04:28 mbox

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Music

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Pictures

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Public

drwx------ 7 root root 4096 2008-07-27 04:32 sysreport-fedora.gnulinux.com3716

-rw------- 1 root root-07-27 04:40 sysreport-fedora.gnulinux.com3716.tar.bz2

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Templates

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Videos

[root@fedora ~]#

 

3.  Enter to the extracted directory using the cd command, and then execute the ls command to list all the file inside the directory.

view inside the bz2 folder

[root@fedora ~]# cd sysreport-fedora.gnulinux.com3716

[root@fedora sysreport-fedora.gnulinux.com3716]# ls

boot df free ipcs lshal lspci mdadm proc route sysreport.log var

chkconfig etc hostname lib lsmod ls-samba modinfo ps sestatus uname wbinfo

date fdisk-l ifconfig ls-boot lsof lsusb mount pstree sysctl uptime

[root@fedora sysreport-fedora.gnulinux.com3716]#

 




0 comments: