Tag Archives: file

How to find the process that has locked a file or directory in Ubuntu

When you open a program in Ubuntu, it might quit complaining that another process has locked a file or directory it is trying to open.

For example, here is an error of this kind:

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

To continue, you might have to find the offending process and stop it. The lsof command can be used for this purpose.

For example, to find out which process has locked the /var/lib/dpkg directory in the above example:

 $ lsof | grep /var/lib/dpkg
 

Tried with: Ubuntu 12.04.1 LTS

About these ads

Agent Ransack: Search inside Office, PDF and other files

Windows 7 has a good search engine that can be used to search for text inside files. However, it requires indexing to be turned on for this feature. I do not like the indexing happening in the background nor do I like indexed information to be stored before I search for something.

If you are in the same boat as me, then give Agent Ransack a try. It can search for files that contain a certain text. It builds the index on the fly and does not store it for future use. It includes support for searching inside popular binary file formats like Microsoft Office, Libre Office and PDF.

Tried with: Agent Ransack (Release Build 762 – 2010.03.29.47911)