Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
Possible duplicate? –  Tom Brossman Aug 29 '12 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. –  Eliah Kagan Aug 29 '12 at 7:30
    
I wonder why you ran that command?? –  Ravi Aug 29 '12 at 7:41
add comment

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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