9

I have mistakenly deleted the ls executable from the /bin folder.

Can I recover it or install it through the terminal?

2
  • 2
    Also available are the "crazytown answers", e.g. "Google the source for the Plan9 ls, type it in, and use gcc to compile it". (In all seriousness, @c0rp has the correct answer when it's just one program you nuked. Try installing trash-cli for the future.)
    – Riking
    May 16, 2015 at 21:27
  • You can also recover files that comes with Ubuntu from iso or live cd. Visit similar answer
    – Pandya
    May 23, 2015 at 13:42

2 Answers 2

29

You could check which package brings ls binary using dpkg:

$ dpkg -S /bin/ls
coreutils: /bin/ls

dpkg will show you that it is package coreutils. Now you only need to reinstall it:

$ sudo apt-get install --reinstall coreutils
0

I know that my answe is coming is too late but it will assist others in the future. I had deleted ls command

As a root user,

Use

# sudo apt update

Then after the update,

Type your deleted command. In my case

# ls

Then you'll see a prompt

Command 'ls' not found can be installed with:
apt install coreutils
Do you want to install it? (N/y) then type y

You're done wait for it to update! Go back confirm if it is done As a root user type the deleted command

ls 
0

You must log in to answer this question.

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