I've been tasked to archive certain files into a new directory at /home/archive/
.
I used this command:
mkdir /home/archive
cd /home/archive
tar -cvf log.tar \
/var/log/auth.log /var/log/alternatives/log \
/var/log/bootstrap.log /var/log/cron.log \
/var/log/dpkg.log /var/log/kern.log /var/log/mail.log
Sorry for the long command line but I only need those files from the entire /var/log directory.
The issue I have is that when I execute the long command as stated above, it works but it shows the entire file path when I do less log.tar
(to view contents without extracting just yet).
I want it to display this:
alternatives.log
auth.log
bootstrap.log
cron.log
dpkg.log
kern.log
mail.log
Instead, it has the /var/log path before the file name. Sorry if it's confusing to read all this but I would greatly appreciate the help!
Best Answer
The quick solution would be to run running your command differently. Run it from within /var/log.