Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to recover a file overwritten with another in Linux? [closed]

I did this on the command line(Ubuntu 12.04)

mv some_arbit_file required_file

Is there any way I can recover required_file. I had put so much work into this. I usually backup files. But, I forgot this time. Will appreciate any help.

Thanks.

like image 751
Rakesh Avatar asked Oct 21 '25 06:10

Rakesh


1 Answers

You can't "undo" your command. Maybe you can found some recovery tools that will help you...

By the way the next time, to avoid this kind of trouble I suggest you use the -i option. It will tell you if you're going to overwritte a file.

You can create aliases in ~/.bashrc :

alias mv="mv -i"
#you can also add aliases to cp and rm
alias cp="cp -i"
alias rm="rm -i"
like image 141
alain.janinm Avatar answered Oct 23 '25 21:10

alain.janinm