How to recover the log file if it is delete any running application in linux?

Connect with

Today by mistake I delete log file from of any running application for example apache, now problem set is how can i recover that log without any 3rd party recovery tools.

we are going to discuss if we can recover that file what are the step of recovery.

Those who are very experienced in linux must know how to do this.

For example I have an application “demo” that is running that that create a log file “my-demo-log.txt’ and in running application my mistake user delete the "my-demo-log.txt" file .

Step: Find process Id of your process, in my case “demo” is process.


# ps aux | grep demo

shakti 8071 0.0 0.3 3878 10987 ? Ss 13:01 0:00 /home/shakti/demo

So from above command we find the main process id of “demo” process.

Now we go to proc file system of that process id.

#ls -ltr  /proc/8071/fd

that out of this command show your that soft link of your delete file and from here user can copy and recover your delete log file in linux.

# cp /proc/8071/fd/my-demo-log.txt /home/ -v

 

 

 


Connect with

Leave a Reply

Your email address will not be published. Required fields are marked *