How to recover a deleted file by "rm" command?

Asked

Viewed 287 times

1

I deleted a file by accident via the command rm.

Is there any way to get it back?

  • Good afternoon Rodrigo, do you want to develop a software to recover? Otherwise, you will only be able to do this with specific recovery software, as far as I know.

  • I figured they’d want to close the question. It wasn’t me :)

  • Gee, it’s about programming, yeah. :)

  • So Rodrigo is not only the issue of programming, but as this in the current question, does not evidence anything programming, only if there is a way to recover, which in the case so far is only about rm. If the question is better elaborated probably will not be closed, because the way this it gives gaps for answers that have nothing to do with programming, understand? I hope you take it as a constructive criticism :)

  • It’s true, it makes sense. : ) I will improve it to avoid this kind of situation.

1 answer

0

There are possibilities, but it could make your system inconsistent (if the application is still running), I suggest you check with the server administrator if you have any backup. Also I suggest that you use the "recycle bin" system so that it does not occur again in the future.

#move the trash to the trash bin:

  alias deletar 'mv\!* ~/.lixeira'

#irreversible exclusion:

  alias excluirLixeira 'rm -rf ~/.lixeira/ ;mkdir ~/.lixeira'

#check if the bin exists:

  if ( ! -d ~/.lixeira ) mkdir ~/.lixeira

Browser other questions tagged

You are not signed in. Login or sign up in order to post.