LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 02-26-2013, 12:58 AM   #1
Ztcoracat
Senior Member
 
Registered: Dec 2011
Distribution: Slackware, Mint & CentOS
Posts: 3,433
Blog Entries: 1

Rep: Reputation: Disabled
How to creat a Tar Ball


Hi:

First time attempting "creating a tarball" and having trouble understanding what the terminal needs.

Read this page to help myself:
http://www.cyberciti.biz/faq/creatin...-command-line/

I'm wondering what else should be executed and what directory is generally the desired one to untar things in?

I went to my Home folder and created a new file 'TARS'
I than created a new empty document and titled it 'Practice'
This is what I have so far but have not a clue what the next step is that I should be initiating or what else I need to do-

Code:
ztcoracat:~$ tar cvzf tarfile.tar.gz TARS
TARS/
TARS/Practice
ztcoracat:~$
Where will Debian put this tar-ball that I have created and any other tar that I create in the future?

Does that depend on what directory I am in at the present or does that need to be indicated at the end of the new tar cmd ? Like so:
Quote:
tar cvzf tarfile.tar.gz ~/Pictures

Last edited by Ztcoracat; 02-26-2013 at 01:02 AM.
 
Old 02-26-2013, 01:07 AM   #2
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,591

Rep: Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244
Hi,

the tar-ball will be put exactly where you tell it to be put. In your example it will be put in the current directory (in that case your home directory). If you want to it to go somewhere else just specify it. Eg to put it in /tmp:
Code:
ztcoracat:~$ tar cvzf /tmp/tarfile.tar.gz TARS
Regarding where to untar things, that depends entirely on what it is you are untaring.

Evo2.
 
Old 02-26-2013, 01:18 AM   #3
Ztcoracat
Senior Member
 
Registered: Dec 2011
Distribution: Slackware, Mint & CentOS
Posts: 3,433
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Thanks evo

Quote:
that depends entirely on what it is you are untaring.
Let's say for example I download a tarball and it is an application that I want to install.
Is there a better suited directory other than downloads for this tarball?
 
Old 02-26-2013, 01:33 AM   #4
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,591

Rep: Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244
Hi,

Quote:
Originally Posted by Ztcoracat View Post
Let's say for example I download a tarball and it is an application that I want to install.
Is there a better suited directory other than downloads for this tarball?
Hmm, still depends on what it is, and who will be using it. For example, a common place for prepackaged binaries like this might be /opt/, or perhaps if it is only for one user, in that users home directory, or even ~/opt/. If the package follows the FHS then perhaps /usr/local or if just for a single user ~/local. It is always best to check the documentation for whatever it is you are untarring/installing.

Evo2.
 
Old 02-26-2013, 01:43 AM   #5
Ztcoracat
Senior Member
 
Registered: Dec 2011
Distribution: Slackware, Mint & CentOS
Posts: 3,433
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Quote:
It is always best to check the documentation for whatever it is you are untarring/installing.
Agreed-
Could you recommend a tarball that I could go and download from the internet and check the 'Read Me' or 'Install' file to understand where I should untar?
 
Old 02-26-2013, 01:52 AM   #6
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,591

Rep: Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244Reputation: 1244
Hi,
Quote:
Originally Posted by Ztcoracat View Post
Could you recommend a tarball that I could go and download from the internet and check the 'Read Me' or 'Install' file to understand where I should untar?
sorry no. I'm happy to help you with specific problems, but I'm not going to generate homework exercises for you.

Evo2.
 
Old 02-26-2013, 02:06 AM   #7
Ztcoracat
Senior Member
 
Registered: Dec 2011
Distribution: Slackware, Mint & CentOS
Posts: 3,433
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by evo2 View Post
Hi,

sorry no. I'm happy to help you with specific problems, but I'm not going to generate homework exercises for you.

Evo2.
This is not homework I am in my late 50's- and retired- -

I understand now how to create a tarball.
Now I just need to learn how to unzip or extract it-

I went to the tarfile.tar that I made and opened my home directory. Upon opening the home directory I right clicked on my newly created tar and the drop down menu gave me:
-open with Archive Manager
-make link
-rename
-encrypt
-Send to
-Extract here.....
Do I choose Extract here or open the terminal and use this cmd?
Code:
tar -zxvf (nameoftar) tar.gz
 
Old 02-26-2013, 05:07 AM   #8
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
Just try it

Basic cmd

Code:
tar -zxvf file.tar.gz
Have a read of http://linux.die.net/man/1/tar and basically play with the options.
That cyberciti link of yours pretty much covers the basics, but there's a lot more possibilities.

Last edited by chrism01; 02-26-2013 at 05:13 AM.
 
Old 02-26-2013, 02:04 PM   #9
Ztcoracat
Senior Member
 
Registered: Dec 2011
Distribution: Slackware, Mint & CentOS
Posts: 3,433
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Code:
ztcoracat:~$ tar -zxvf tarfile.tar.gz
TARS/
TARS/Practice
ztcoracat:~$ tar -zxvf file.tar.gz
tar (child): file.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
ztcoracat:~$
I know it's not a good practice to assume but I'll assume the first try was correct because I used the name (tarfile) that I gave.
 
Old 02-26-2013, 08:41 PM   #10
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
Code:
tar (child): file.tar.gz: Cannot open: No such file or directory !!
Obviously you can't just make stuff up

Incidentally, tar is just a generic archiving tool. The content can be anything, so you have to un-tar it to find/read the (content specific) docs (if any ...)

Last edited by chrism01; 02-26-2013 at 08:43 PM.
 
Old 02-26-2013, 11:06 PM   #11
Ztcoracat
Senior Member
 
Registered: Dec 2011
Distribution: Slackware, Mint & CentOS
Posts: 3,433
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Quote:
The content can be anything,
Didn't know that...I appreciate you telling me that-

Thanks for that link. That man-page helps and I now understand and things make more sense

What directory do most folks untar in? (or) does (like Evo said) depend on what it is?
 
Old 02-27-2013, 01:27 AM   #12
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
Pretty much yes...
Normally if you're eg installing some tool, then the web page will make a recommendation.
Alternately, I usually go for /opt/. This is just to unroll the tar file. Once its unpacked, the accompanying docs (if any) usually tell whether you can specify final install dir (if you can change it).
Typically for a src code set (usually in C), you invoke the make cmd and specify a config prefix; see the docs.

If its a backup you made, you should know where to put it
Check the -P option if you are doing this

Basically, as you can see, there's a LOT of options to this cmd. Easiest is to google through a load of examples and check the flags used until you feel comfortable.
 
1 members found this post helpful.
Old 02-27-2013, 01:21 PM   #13
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: Arch + X.org + IceWM
Posts: 1,208

Rep: Reputation: Disabled
I don't like using “z” option. Much easier to use “a” (auto) and specify compression by extension (you won't need to remember all options for all compression methods):

Code:
tar cavf this-is-my-ultra-compressed-archive.tar.xz file1 file2 fil3 some-dir
  • *.tar.gz for gzip (poor compression)
  • *.tar.bz2 for bzip2 (middle compression)
  • *.tar.lzma for LZMA (best compression)
  • *.tar.xz for XZ (best compression)

They all have different letters as options (“-z”, “-j”, “--lzma”, “-J”) but “a” will work for all.
 
3 members found this post helpful.
Old 02-27-2013, 10:41 PM   #14
Ztcoracat
Senior Member
 
Registered: Dec 2011
Distribution: Slackware, Mint & CentOS
Posts: 3,433
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Chrism01 & Mr. Alex:

I wrote everything down that you posted- -

Thank you both; very much!

Last edited by Ztcoracat; 02-27-2013 at 10:42 PM.
 
Old 03-01-2013, 12:34 AM   #15
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
Actually most (all?) of those tools have an option to specify how efficiently to compress (usually a range from 1 - 9, default 6), so those comparisons don't follow.

As for switches, if I can remember the correct file extension, I reckon I can remember the matching switch
Besides, most people pick a compression tool/option & use the same one most of the time.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to search for a pattern of a tar ball and pipe that name to tar to extract linux_newb Linux - General 2 02-27-2012 05:28 PM
Missing tar ball eliteparakeet Linux - Newbie 5 10-31-2011 12:45 PM
Help with tar ball noelc Linux - Software 6 09-26-2009 05:06 AM
tar ball locations ThisGuyIKnow Linux - Newbie 3 08-09-2006 11:48 AM
tar ball uninstall? Xris718 Linux - General 3 09-20-2004 09:55 PM


All times are GMT -5. The time now is 03:52 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration