LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-17-2011, 04:26 AM   #1
emagnun
LQ Newbie
 
Registered: Jul 2009
Posts: 4

Rep: Reputation: 0
Red face difference in size of the tarred files after archiving using tar command


i am using red hat linux 2.4 . I have 3 folders dir1 dir2 dir3

I have tarred them like this.
1.tar cvfz tarball_1.tgz dir1 dir2 dir3
2.tar cvfz tarball_2.tgz dir1 dir2 dir3 2>& /dev/null (So that it does not display any error message or operation details to the user)

[usr@machine]$ ls -lrt
-rw-r--r-- 1 usr grp 199843988 May 17 13:39 tarball_1.tgz
-rw-r--r-- 1 usr grp 199837488 May 17 13:53 tarball_2.tgz

But can any one explain the size difference as seen in list output...
 
Old 05-17-2011, 05:23 AM   #2
sohny
Member
 
Registered: Aug 2004
Location: bangalore
Distribution: Redhat,Ubuntu
Posts: 64

Rep: Reputation: 15
did u mean

Quote:
tar cvfz tarball_2.tgz dir1 dir2 dir3 2>& /dev/null
or

Quote:
tar cvfz tarball_2.tgz dir1 dir2 dir3 2>/dev/null
coz I m getting any error as follows with first one

Quote:
-bash: /dev/null: ambiguous redirect
And i m not see any difference with bot commands u mentioned. I m getting same size
 
Old 05-17-2011, 05:29 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
The same for me. Apparently there is no reason why they should differ, unless their actual content is different. What is the output of the following?
Code:
diff <(tar tvf tarball_1.tgz) <(tar tvf tarball_2.tgz)
 
Old 05-17-2011, 05:33 AM   #4
emagnun
LQ Newbie
 
Registered: Jul 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by sohny View Post
did u mean



or



coz I m getting any error as follows with first one



And i m not see any difference with bot commands u mentioned. I m getting same size

Hi,

The second command is "tar cvfz tarball_2.tgz dir1 dir2 dir3 2>& /dev/null" only.
I have used this to redirect stdout and stderr so that the ouput as well as the error message(if any) will not be displayed to the user. Its a part of error handling in my script.

I dont understand why you are getting the error while issuing the same...

Pls do reply.
 
Old 05-17-2011, 06:48 AM   #5
sohny
Member
 
Registered: Aug 2004
Location: bangalore
Distribution: Redhat,Ubuntu
Posts: 64

Rep: Reputation: 15
I am actually getting a diff in both files buy doing cmp of both the files created buy just a simple tar withoput redirting. I am assuming the diff is in the info of timestamps of the stored files

@emagnun

I don't know why I m getting that error, but i was able to solve it by putting the "&" before the ">" symbol
 
  


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
How to automate archiving of log files using tar? profi81 Linux - Newbie 2 03-29-2011 06:39 PM
What is the difference between Archiving and Backup of data? kris_rocks! Linux - General 2 02-24-2010 01:43 PM
Getting the size of the folder without using the tar command Berris.Oliver Linux - Newbie 1 03-02-2009 09:22 PM
update bsd tar for archiving jyoti100in *BSD 2 11-02-2005 03:46 PM
Couple of questions about Dual-booting, and .TARred files Subwall Linux - Newbie 1 02-27-2004 07:07 AM


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