Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Tuesday, November 22, 2011

Recover deleted file on Linux


If you deleted a file on linux based OS accidentally, and want to recover it, lsof command may help you.

lsof is a Linux tool which can show open files and network connections, and even recover deleted files.

If you have ever deleted a file by mistake; been clearing up log files, or just used rm without thinking, there is a way of recovering that deleted file. For example, to recover a missing access_log used by Apache you can search for it via this command:

$ lsof | grep access_log

which output will be similar to:

httpd 26120 apache 42w REG 253,0 5852 12222531 /apachelogs/access_log (deleted)

The key word to look for here is deleted in brackets. The good news is a process (26120) still has the file open and without this process keeping the file open we would have lost the file permanently. So, with the Apache daemon helping us out we can view the missing info by looking inside the proc filesystem, the process id (26120), and finally in the file descriptor (fd):

$ cat /proc/26120/fd/42

This outputs the contents of my deleted access_log which shows the data is still there. All you need to do now is simply redirect the contents back to /apachelogs/access_log, like this:

$ cat /proc/26120/fd/42 > /apachelogs/access_log

Now you have recovered your access_log with all the data back to its original location. (You should also restart Apache). lsof can do much more, however, this is one example which could save the day.

Feel free to share other useful example of lsof here (in comments).

Tuesday, September 25, 2007

Google Desktop Search Now For Linux...



Google has released a new version of Google Desktop with support for Linux. As with early
versions of the Windows tool and the recently release Mac OS X tool, Google Desktop for Linux is just the desktop search engine component, but the company says eventually support for the sidebar and gadgets will be added. The Linux version of Google Desktop can index OpenOffice documents, PDF and PostScript files, text and HTML, man pages, music, video and image files, web history (provided you use Firefox) and emails from Gmail and/or Thunderbird.
If you’re not a Firefox user Google Desktop can still index things like bookmarks, but you won’t have access to your web history.
Currently Microsoft Office documents can not be indexed and, regrettably, neither can chat transcripts or archive files.
Google Desktop for Linux officially supports Ubuntu 6.10+, Debian 4.0+, Fedora Core 6+, SUSE 10.1+ running on x86 hardware, however, so long as you have the core components (glibc 2.3.2 or later and gtk+ 2.2.0 or later) installed, it should work with just about any x86 distro.
Unlike some Google offerings, Google Desktop for Linux is not open source. Google says the tool is based on its own desktop search algorithms not existing Linux search programs.
Although there are already some great desktop search programs for Linux (Beagle comes to mind), it’s nice to see Google make good on its promise to delivery more Linux software offerings. Google Desktop for Linux joins Picasa, Google Earth and the Firefox toolbar, all of which offer Linux support.

LinkWithin

Related Posts with Thumbnails