LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-16-2018, 07:31 AM   #1
kevinck
LQ Newbie
 
Registered: Jul 2018
Posts: 1

Rep: Reputation: Disabled
Executing tar.gz and tar.bz2 files


Hey all,

I wouldn't say I'm completely new to linux, as I've been using various distros for several years now (JoliOS, ubuntu, lubuntu, mint).

Admittedly, I"m not very savvy (though I'm getting better) with the comand line. One thing that has constantly confounded me is executing tar.gz and tar.bz2 files. Most of the videos and advice online meant for newbies, frankly, can be impenetrable to newbies.

I am determined to get it, and, once I do, am really thinking about doing a youtube video that explains in as plain language as possible. I believe that tarball files are one of the potentially biggest obstacles to more folks staying with linux, so I want to offer a really easy-to-follow list of instructions for how to execute these files.

Would anyone be willing to 'dumb it down' for me and walk me through how to execute tarballs? This, again, both so I can learn it myself and to put that learning into what I hope will be an easy-to-follow-for-new-linux-users video. (I'll give you credit in the video, of course.)

Thanks.
 
Old 07-16-2018, 11:06 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
tar files are archive files, they are not executables, they are storage archives.

Extensions for them such as bz2 or gz simply mean that they are zipped using some type of compression tool.

With tar, here are "my" shortcuts that I've retained over the years. And this is all command line, not UI and double clicking and such. (Meanwhile if you double click on a zipped tar file, or just a tar file, it will open an archive management tool to allow you to extract the files and put them somewhere.

Tar notes:

tvf
xvf
cvf

The "vf" means output information using verbose and follow directories downwards. Therefore you'll "see" the information that occurs and you'll also retain a directory structure if you have a tar file which contains a directory tree. Having a directory tree of archived files is very command common (edit fix).

"t" means to generate a report. Thus "tar tvf <filename>.tar.<zip-extension-if-any> will generate a report of the contents of the tar file.

"x" means to extract the files. "tar xvf <filename>" will extract the archived files.

"c" means to create a tar file. "tar cvf <tar-filename> <filename(s) to archive>" will create an archive.

You do not need to worry about unzipping a zipped file. Just run "tar xvf <tar-filename>"

You do not need to worry about specifying arguments to zip when creating a new archive, if you give an extension it will do this automatically.

"tar cvf sample.tar.bz2 <files ...>" will create a bz2 zipped filename as part of the archive process.

Same for various other zip extensions if you wish. You also do not have to zip the file at all if you don't want to.

Last edited by rtmistler; 07-16-2018 at 12:13 PM.
 
1 members found this post helpful.
Old 07-16-2018, 11:30 AM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,735

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
^^An excellent overview.

To clarify a couple of points: The -f option names the file (or device) being acted upon. From man tar:
Code:
-f, --file=ARCHIVE
           use archive file or device ARCHIVE
"device" of course, refers to the tape device when something is actually being written to tape.

And the -a,-z or -Z option needs to be added if the tar file is compressed. -a will use the suffix of the file name to determine the compression program.
so
Code:
tavf
xavf
cavf
if the archive file is compressed/to be compressed.

This from tar version 1.26 on CentOS 7.4
 
Old 07-16-2018, 08:22 PM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
I hope after you read this that you'll reconsider making the video. To install a tarball,
Code:
$ tar zxvf file_name.tar.gz
$ tar jxvf file_name.tar.bz2
$ cd file_name
$ ./configure
$ make
$ sudo make install
It's the linux equivalent of putting on a t-shirt.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] LFS 7.3--> tar xf lfs-bootscripts-20130123.tar.bz2 , bash : tar : command not found AkiraMizuki Linux From Scratch 3 06-01-2013 03:00 AM
compile and installation of .tar.bz2/.tar.gz files jmenew Linux - Newbie 14 01-04-2013 02:53 AM
How can i create .tar.gz,.tar.bz2,.zip file and upload with filezilla=> uncompress? cola Linux - General 1 09-14-2011 01:32 PM
tar-command not found while compiling glibc-libidn-2.7.tar.bz2 of lfs6.3 aditya_gpch Linux From Scratch 1 05-13-2008 11:27 PM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration