Deleted ls

jariev202

macrumors newbie
Original poster
May 6, 2005
7
0
Accidentally I deleted the file /bin/ls :( !!!!!!

I'm using osx 10.4.2

Anyone knows how I may recover it?

Thanks!
 

alex_ant

macrumors 68020
Feb 5, 2002
2,473
0
All up in your bidness
ChrisBrightwell said:
Here's a question ... how did you delete /bin/ls?

For me to put symlink in /bin, I had to sudo it.
He was probably logged in as root.

The ability to delete the very commands that are used to control the computer - a great idea, that. I anxiously await this feature in the next generation of nuclear reactor control panels.
 

risc

macrumors 68030
Jul 23, 2004
2,756
0
Melbourne, Australia
If you are the kind of person that goes around deleting stuff like ls maybe you want to put

alias rm='rm -i'
alias mv='mv -i'

in ~/.profile
 

mkrishnan

Moderator emeritus
Jan 9, 2004
29,641
12
Grand Rapids, MI, USA
alex_ant said:
The ability to delete the very commands that are used to control the computer - a great idea, that. I anxiously await this feature in the next generation of nuclear reactor control panels.
I thought it was definitively resolved that the next generation of nuclear power plants would be using Windows ME for all mission-critical applications.

Seriously, though, I remember AmigaDOS was set up so that the core sort of "built-in" commands that were equivalent to ls, mv, cp and so on, were part of the kernel or something, so that they could not be deleted in this fashion, and that only more ancillary commands were stored in its analog to the /bin folder....

But I guess this emphasizes why you should use sudo and not log in as root, whenever humanly posssible. :D
 

jariev202

macrumors newbie
Original poster
May 6, 2005
7
0
I was not logged as root. I know that's really dangerous. I was doing some configurations and had to copy one file to /bin but without wanted it I did a copy to /bin/ls, not to /bin so i rewrited ls with my file :(

This important system commands should be part of the kernel so we may not delete them!

Thanks again from helping me, something like this may arrive to everybody

:cool:
 

Linkjeniero

macrumors 6502
Jan 6, 2005
255
0
I don't understand why is everyone so eager to take flexibility away... that's what makes UNIX so good! If you want to make sure you won't accidentally erase some file, just set the appropiate permissions (and all those really important files are owned by the root; if you managed to overwrite ls without being root, then the permissions were wrong).
 

risc

macrumors 68030
Jul 23, 2004
2,756
0
Melbourne, Australia
jariev202 said:
I was doing some configurations and had to copy one file to /bin but without wanted it I did a copy to /bin/ls, not to /bin
better add

alias cp='cp -i'

or maybe cp -n

to my list above then ;)

jariev202 said:
This important system commands should be part of the kernel so we may not delete them!
That's not what a kernel is. This is mistake made by an inexperienced user nothing more. Maybe Apple should make the aliases part of your .profile by default, but I guess they think if you need to open the terminal you know how to use it?

All you needed to do to fix this yourself was to reinstall BaseSystem.pkg.