Moved a shared library, now I can't run any commands

I ran sudo mv /lib/x86_64-linux-gnu/libpthread.so.0 ~, which in retrospect, was not the world's greatest idea.

Now, I can't do anything. Any commands I run fail with error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory.

I can't run apt, I can't even do an ls. I can't move the file back with [sudo] mv ~/libpthread.so.0 /lib/x86_64-linux-gnu/. I can't run ldconfig. Any ideas on how to undo this damage?

One possible relevant fact is that /lib/x86_64-linux-gnu/ also contained the file libpthread-2.27.so, which was perhaps symlinked with libpthread.so.0 somehow?

I don't think it matters, but this is Ubuntu 18.04 running on WSL.


Fortunately, I was able to fix my problem.

I wasn't able to use sudo, since it resulted in the error above. However, I was able to follow the directions here to make the terminal start as root. At that point, I was able to make a new symlink ln -s /lib/x86_64-linux-gnu/libpthread-2.27.so /lib/x86_64-linux-gnu/libpthread.so.0.

I reset the user back to my personal account, and the problem was fixed.