Debian : -bash: ls: command not found

I have a vm to play with linux and wanted to try rbash. I followed a tutorial to make it work. Then I wanted to remove the stuff i've done, and delete a symlink from /bin/ls to /etc/skel/. But instead of using unlink command, I use rm -r on /etc/skel/ls and deleted the binary Ls from /bin/ folder (literaly).

Now I've got -bash: ls: command not found when I want to use ls command. Is there a way to reinstall this default command ? To download the bin ?


Depends on what Linux distro you are using.

Typically, you can force reinstall a package, and hence, get back all its files.

For example, in a Debian based system, like Ubuntu, you'll see:

dpkg -S /bin/ls

"ls" belongs to "coreutils".

Therefore, force reinstall the package:

sudo apt-get --reinstall install coreutils

And, your accident will be fixed!