I was copying a file to /usr/local/bin from the commandline on a Snow Leopard Server 10.6 ... anyhow i typed the following ...

sudo cp ./le /usr/local/bin

Ouch ... that missed last forward slash from a bash shell screwed me. It wacked my directory with a copy of the le file renamed as bin. This is a pretty vanilla machine just used a fileshare. Any thoughts on how to recover? Noticed there is no lost+found ... err, at least I didn't see it in root directory.

  • Actually this should just copy le into /usr/local/bin, not overwrite it. Are you sure that you lost your bin directory that way?
    – nohillside
    Commented Sep 5, 2013 at 4:08

2 Answers 2


Unfortunately there is no way to recover from that, aside from restoring from a backup. Command line utilities don't have an undo command (and they don't typically delete to the Trash).

lost+found wouldn't help either, since that is only used when a filesystem recovery utility has found filesystem corruption.


What Brian said, you are in no return land. To avoid such problems in the future add this line to your .bashrc:

alias sudo='sudo '

(and restart bash)

this way cp, mv, rm and suchlike will ask you before they overwrite or delete something. That has saved my bacon a few times.

  • This does not work in the general case... it will only work if you have aliases set up that cause those commands to ask confirmation.
    – 0942v8653
    Commented Apr 23, 2020 at 5:55

You must log in to answer this question.

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