-   Linux - Newbie (
-   -   tar command help (

gtriant 08-06-2010 10:40 AM

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

grail 08-06-2010 10:48 AM

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:

tar acf itic_glb_cognity-06082010.tar.gz itic-glb-cognity/

druuna 08-06-2010 10:48 AM


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.

gtriant 08-06-2010 11:14 AM

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

druuna 08-06-2010 11:17 AM


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....

gtriant 08-06-2010 11:24 AM

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 !!!

druuna 08-06-2010 11:32 AM



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.

All times are GMT -5. The time now is 08:33 PM.