1

I have an Apache Tomcat running on CentOS7 server which had a file catalina.out of around 157MB in size. I was trying to download that file on my local system so I ran the tar -czf command but I accidentally ran the command in reverse direction:

tar -czf $CATALINA_HOME/logs/catalina.out catalina.out.gz

Which emptied the entire log file. I tried to restore the file but couldn't get success.

I saw the swap file so tried to restore the content like:

vim -r $CATALINA_HOME/logs/catalina.out

But this didn't work. Is there a way I can rollback the logs?

0

The swap file created is hidden with swp extension, so please try using ls -a command on the location which will show the swap file.

Then vim the file using .filename and recover it.

1
  • Thanks for your answer. Although, swap files are created when editing via tool like vim. But this happened from the tar command. May 4 '20 at 3:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.