So I'm new to linux and I have wrote a small script that is suppose to archive the contents that end with.log in /var/log to a tar file called log.tar in a new directory called archive. Then it's suppose to list the contents of the tar file and then extract it to a new file called backup.
tar -cvf log.tar /var/log/*.log
tar -tf tar.log
tar -xf tar.log -C ~/backup
So when I run the script I get this output.
tar: Removing leading `/' from member names
So I was wondering if it's possible to remove the /var/log/ part of the lines when archiving so I instead get this when listing what is in the tar file.
And when I do ls in the backup file I see the var directory and when I do las in the var directory and finally inside the log directory I get the log files. So how do I extract without the /var/log/ path name and directory?