Explain difference of tar command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Explain difference of tar command
# 1  
Old 08-07-2013
Explain difference of tar command

Hello All,

I have been seeing a weird(at least for me, at this point) issue with a specific tar command.

1st fashion)
Normally, if i have to tar anything at the command line I tend to use
tar -cvzf <tar-file_name.tgz> <directory_to_be_tarred>
this command works perfectly fine with out any problem or hiccups.

2nd fashion)
I then had a situation where i needed only the files to be tarred and had to exclude the directory name under which the file were being tar'ed
for example:
my_directory
--- my_file
--- my_file
--- my_file

I only had to tar the files, did some search and ended up using the belowcommand
tar -cvjf <my_directory.tar.gz> -C <my_directory> .

where: The -C my_directory tells tar to change the current directory to my_directory, and then . means "add the entire current directory"

Now the issue: Couple of these file are 7GB and 4GB, when I do the tar in the first fashion the tar ball get created under 10 minutes, but when I use the 2nd fashion the creation of tar ball takes significant amount of time, on an avaerage it take 90 minutes to complete the tar ball.

Wanted to understand why this happens and what needs to be done to correct it.
Please advice.

---------- Post updated at 10:18 AM ---------- Previous update was at 10:02 AM ----------

Is the difference due to
tar -cvzf (1st fashion)
against
tar -cvjf (2nd fashion)

Last edited by getnetha; 08-07-2013 at 12:06 PM.. Reason: Format and spelling correction done
# 2  
Old 08-07-2013
Quote:
Originally Posted by getnetha
---------- Post updated at 10:18 AM ---------- Previous update was at 10:02 AM ----------

Is the difference due to
tar -cvzf (1st fashion)
against
tar -cvjf (2nd fashion)
yes ... the 1st one uses gzip to compress the file after creating the tarball while the 2nd one uses bzip2 ... to properly compare the difference, you need to compress the resulting tarball the same way ...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Please help to explain the command

su - keibatch -c ""date ; /usr/local/kei/batch/apb/bin/JKEIKYK4140.sh -run "&$C$6&" WSUKE100201"" Not clear about : date ; /usr/local/kei/batch/apb/bin/JKEIKYK4140.sh -run "&$C$6&" WSUKE100201 Please help (2 Replies)
Discussion started by: honda_city
2 Replies

2. UNIX for Dummies Questions & Answers

Please explain this command?

Hi, I saw this. But I don't know why we need this? ls mydir > foo.txt ## I know what this will do, it will take the results and write to the file called foo.txt ls mydir > foo.txt 2>&1 ## Don't know why we need 2>&1 Thanks. (2 Replies)
Discussion started by: samnyc
2 Replies

3. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

4. UNIX for Dummies Questions & Answers

Difference between 'pax', 'tar', and cpio

Could any one please help me in understanding the difference between pax,tar and cpio. all of them basically creates archive files. (9 Replies)
Discussion started by: joshi123
9 Replies

5. UNIX for Dummies Questions & Answers

Explain the difference between the commands cd ~smart and cd ~/smart

Is it possible for both commands to work? (1 Reply)
Discussion started by: phunkypants
1 Replies

6. Shell Programming and Scripting

tar command dont tar to original directory

HI, if I have a tarfile called pmapdata.tar that contains tar -tvf pmapdata.tar -rw-r--r-- 0/0 21 Oct 15 11:00 2009 /var/tmp/pmapdata/pmap4628.txt -rw-r--r-- 0/0 21 Oct 14 20:00 2009 /var/tmp/pmapdata/pmap23752.txt -rw-r--r-- 0/0 1625 Oct 13 20:00 2009... (1 Reply)
Discussion started by: borderblaster
1 Replies

7. AIX

MKSYSB + tar / on same server: difference and useless ?

Hi again, we have several types of backups we do here. On the workstations backups that we do every 3 months, we do 2 backups on each ones: mksysb and a TAR /. I need to understand better what that mksysb does and figure out if doing both is useless where only one is enough I am looking at... (1 Reply)
Discussion started by: Browser_ice
1 Replies

8. UNIX for Dummies Questions & Answers

Can anyone explain what this command is doing?

Specifically what is the purpose of sed? What is f? Why is the 'cp f $phonefile' line needed when the script ‘goes live'? Why might that two commands following sed be commented out at the present time ( i.e., during development)? Thanks in... (2 Replies)
Discussion started by: knp808
2 Replies

9. UNIX for Dummies Questions & Answers

oh fork() and vfork() someone explain the difference?

Can somebody explain to me the differences between fork() and vfork() system calls using C programs which I can implement in the UNIX environement? (1 Reply)
Discussion started by: lvkchaitanya
1 Replies

10. UNIX for Advanced & Expert Users

Tar/Tapes: Can somebody explain this to me......

Hey Folks, Can somebody please explain what the crack is with this problem. I have a backup folder in /var which contains 4 rsync'd server folders: server08 server15 server16 server18 They all contain the etc folder from the server, and other important data I need to backup. To... (2 Replies)
Discussion started by: modaceface
2 Replies
Login or Register to Ask a Question