The find command gives this output:
[root@localhost /]# find var/log/ -iname anaconda.* var/log/anaconda.log var/log/anaconda.xlog var/log/anaconda.yum.log var/log/anaconda.syslog var/log/anaconda.program.log var/log/anaconda.storage.log
After combining with tar it's showing this output:
[root@localhost /]# find var/log/ -iname anaconda.* -exec tar -cvf file.tar {} \;
var/log/anaconda.log
var/log/anaconda.xlog
var/log/anaconda.yum.log
var/log/anaconda.syslog
var/log/anaconda.program.log
var/log/anaconda.storage.log
But while listing tar file it's showing only a single file
[root@localhost /]# tar -tvf file.tar -rw------- root/root 208454 2012-02-27 12:01 var/log/anaconda.storage.log
What I am doing wrong here?
With xargs I am getting this output:
[root@localhost /]# find var/log/ -iname anaconda.* | xargs tar -cvf file1.tar
Second question
While typing / in front of var, means find /var/log why its giving this mesaage tar: Removing leading `/' from member names
[root@localhost /]# find /var/log/ -iname anaconda.* -exec tar -cvf file.tar {} \;
tar: Removing leading `/' from member names
/var/log/anaconda.log
tar: Removing leading `/' from member names
/var/log/anaconda.xlog
tar: Removing leading `/' from member names
/var/log/anaconda.yum.log
tar: Removing leading `/' from member names
/var/log/anaconda.syslog
tar: Removing leading `/' from member names
/var/log/anaconda.program.log
tar: Removing leading `/' from member names
/var/log/anaconda.storage.log
In a simple form what is the difference between in the following two?
find var/log and find /var/log