I accidently ran
sudo rm *
I thought I was in an unimportant subfolder.
The result is that I deleted some very important files. Is there any way to get my data back?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
But I prefer
sudo apt-get install foremost
Take a look at
to learn how to use foremost.
First make an empty writable directory to save recover files in a partition other than that you are going to recover.
Then run foremost.
I am going to recover my home partition ( let's say
$ sudo foremost -t jpg -i /dev/sda5 -o /recovery/data
Finally set user permission to /recovery/data/ to view image. type
$ sudo chown YOUR_USER_NAME /recovery/data -R
Some important foremost command line arguments.
-i :- partition/image to recover -o :- location to store recovered files. -t :- built in file filter options. you can give multiple filters by separating using commas. (e.g: for jpg and pdf: -t jpg,pdf ) -q :- quick mode.
After the steps from @2707974 above, then you can use this bash utility lines to browse millions of files quickly and painless, something like this:
`$ mkdir /recovery/filtered && cd /recovery/data && SKIP=1300 #SKIP value depends on your needs $ for((j=$SKIP; j<10000; j=j+100)); do for i in $(ls -S . | head -n $j | tail -n 100); do cp $i ../filtered/; done; sleep 10; rm ../filtered/*; done`
And then now, you can open /recovery/filtered on your file browser, and watch your history...