4

How can I get back /usr/local/lib? I accidentally deleted it.

I ran sudo rm -Rf lib inside /usr/local/.

I am using 12.04.

3
  • Possible duplicate? Aug 29, 2012 at 6:59
  • @TomBrossman No, we should not close this as a duplicate of that question. It's not really reasonable to recommend using data recovery methods unless the data cannot be easily regenerated or replaced. Recovered files may be damaged, when many files have been deleted the directory structure sometimes must be reconstructed by hand, and the amount of effort it takes to recover deleted files is often very great. Aug 29, 2012 at 7:30
  • I wonder why you ran that command??
    – Ravi
    Aug 29, 2012 at 7:41

1 Answer 1

3

The standard use of /usr/local/lib is to store library files installed from software built from source. It is standard to store the source code in /usr/local/src.

Assuming this is the way the folder was used, you can simply reinstall the software that provided the library files.

Most of the time, software is built something like this:

./configure
make
sudo make install

Those commands are run from inside the particular program's source directory, which is typically a subdirectory of /usr/local/src.

So, just go back there (for each program or library installed, as even applications may provide files stored in /usr/local/lib) and run sudo make install again.

If you had run make clean or make distclean inside the source directory after installing (which is generally inadvisable, even though many bloggers recommend it, because it saves a bit of space but at the cost of making it difficult to reinstall or uninstall), you'll have to build from source again.

If you didn't keep the source code at all, you'll have to redownload it, unpack it, and install it, as you had done before.

Even in the worst case scenario where you are not sure what programs you had installed from source, it's still usually much easier to figure that out than to use generic file recovery methods. Such methods are usually difficult and time consuming and only give you back part of what you had hoped to recover; the libraries in /usr/local/lib, and whatever programs depend on them, would likely not run correctly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .