LinuxQuestions.org
Register a domain and help support LQ
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 08-06-2010, 11:40 AM   #1
gtriant
LQ Newbie
 
Registered: Aug 2010
Posts: 5

Rep: Reputation: 0
tar command help


Hello all,

trying to make my first tar file in linux. I am trying to make a tar file from a folder (with all subfolders and files) and using several commands i got several errors!

This is the tar usage:
tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile] [blocksize] [[-C directory] file] ...

Some of my attempts and responses:

tar -czf itic_glb_cognity-06082010.tar.gz itic-glb-cognity/
response: tar: z: unknown option (not using 'z' again!)

tar -cf itic-glb-cognity-06082010.tar.gz itic-glb-cognity/
response: tar: cannot stat itic-glb-cognity. Not dumped.

the last ones repeats for all the next attmepts:
tar -cf itic-glb-cognity-06082010.tar.gz itic-glb-cognity
tar -cf iticglbcognity06082010.tar.gz itic-glb-cognity/
(full path + name without spaces) tar -cf iticglbcognity06082010.tar.gz /epos/webbus/bea/user_projects/domains/itic-glb-cognity

for some of the above a 10kb file was created, where the expected file would be about 250MB. I dont think it has anything to do with the user's rights, because I think I have them all.

Any help would be much appreciated
 
Old 08-06-2010, 11:48 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,251

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
Well the first error would appear if gzip is not installed.

All subsequent ones will fail if for not other reason than you can't put a gz extension on and not have the compression switch listed.

Cannot stat normally implies the item does not exist.

Try this and see how you go:
Code:
tar acf itic_glb_cognity-06082010.tar.gz itic-glb-cognity/
 
Old 08-06-2010, 11:48 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

Using tar to create an archive: tar -cf name.of.archive.tar directory
directory can also be a bunch of files (file1 file2 file3 .....).

If you want to make an archive and use bzip2 to compress it:
tar -jcf name.of.archive.tar.bz2 directory

Or, using gzip instead of bzip2:
tar -zcf name.of.archive.tar.gz directory

If you want to extract from a tar archive:
tar -xf name.of.archive.tar

From an archive that is compressed using bzip2:
tar -jxf name.of.archive.tar.bz2

Or compressed with gzip:
tar -zxf name.of.archive.tar.gz

Show the contents of an archive:
tar -tf name.of.archive.tar

There are a lot more options and possibilities, but the above are used most often.

Hope this helps.

Last edited by druuna; 08-06-2010 at 01:45 PM. Reason: Added -t example for completeness
 
Old 08-06-2010, 12:14 PM   #4
gtriant
LQ Newbie
 
Registered: Aug 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for your responses...

The answer was.... CASE SENSITIVE!!! When I gave the target folder name with capital letters it worked.
An ftp client inspired me because I saw the folder name was written with capitals!
Is that possible??? (Actually it is because it just worked)

what a good way to waste an hour...
Hope this helps, because the 'tar: cannot stat .......... Not dumped.' error is really under documented on the web
 
Old 08-06-2010, 12:17 PM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

Both unix and linux are case sentive by nature: foo, Foo, FoO and FOO are not the same

One of those things you need to get used to when switching to linux....
 
Old 08-06-2010, 12:24 PM   #6
gtriant
LQ Newbie
 
Registered: Aug 2010
Posts: 5

Original Poster
Rep: Reputation: 0
How come I don't need to be case sensitive when I change directories (cd) though?
How come a "folder not exists" error which would be much more indicative was not generated?

I guess I am a BIG NEWBIE !!!
 
Old 08-06-2010, 12:32 PM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

Quote:
How come I don't need to be case sensitive when I change directories (cd) though?
How do you do this? Are you using tab completion (type cd f then press <tab> to complete)?

I'm asking because when you type it all yourself you should use the correct case (cd foo or cd Foo, both cd to a different directory or generate an error when either of them don't exist).

Although debian and lfs don't do so, I do believe I've seen "smart" tab completion (if only 1 directory exists that starts with an F, cd f<tab> will complete to cd Foo).

In general everything in linux is case sensitive (most tools have an option to be case insensitive, but those aren't "on" by default).

Hope this helps.

Last edited by druuna; 08-07-2010 at 02:12 PM. Reason: Fixed typo.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
where is TAR ? bash: tar: command not found Juicyapple Linux - Newbie 7 06-10-2009 09:32 AM
tar-command not found while compiling glibc-libidn-2.7.tar.bz2 of lfs6.3 aditya_gpch Linux From Scratch 1 05-14-2008 12:27 AM
tar command alias command rlg Linux - Newbie 0 03-11-2008 08:21 AM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 03:53 AM


All times are GMT -5. The time now is 10:57 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration