3

I am new to Linux and Ubuntu. I mistakenly placed my backup into the /tmp folder and now when I try to move those files to /home using cp -r, I lost everything in my /tmp.

The command I used was:

cp -r /tmp /home

Please help me recover my files.

Eliah Kagan
  • 117,780
sivashanmugam
  • 117
  • 3
  • 3
  • 11

2 Answers2

2

Try to use some recover tools like Testdisk or PhotoRec .

TestDisk can recover lost partitions of virtually any filesystem. PhotoRec can recover files of most types, including most picture and video formats. PhotoRec can be used on existing partitions, or can be used to recover files on deleted partitions without having to recover the underlying partitions.

Possible setups for recovery include:

Recover the files to a separate hard drive.
Recover the files to a networked storage drive.
Recover the files to a separate partition on the same hard drive.
Image the hard drive using a tool like ddrescue and recover files using only one partition.

Download them here, both tools are in the same package.

Install the package and try your luck, I hope you can recover your lost files.

Reference

nux
  • 38,017
  • 35
  • 118
  • 131
-1

If you run cp -r /tmp /home command with superuser privileges(sudo), your /tmp directory must be inside /home directory (/home/tmp). You can access the files by cding into /home/tmp directory or you can move to that directory through nautilus.

Once you find the files, copy those to any other location and then restart your PC.

Avinash Raj
  • 78,556