Missing Downloads folder
I'm using Ubuntu 20.04 LTS. Suddenly today, my Downloads
folder went missing. After googling the problem, I used mkdir
to create a new Downloads
folder. It was created successfully, but the files inside it are missing.
When I run:
locate Downloads
in the terminal, all the missing files are listed there, but when I try to open them through the terminal it says:
no such file or directory
I'm attaching some screenshots for more details.
Solution 1:
-
There is a difference between
find
,ls
andlocate
commands. -
ls
- list directory contents, it will show the specific directory you are "standing" at contents. -
locate
- locate find files by name, the command will return a quick answer but it uses a snap shot of the DB what can make issues when the snap shot is not up to date, it means you can find files that have been deleted and cannot find some new files that have been created. -
find
- search for files in a directory hierarchy, the command will take more time to return the answer but it is making a deep scan in your directory hierarchy and will find any file on your file system if you have the permissions to look over all your file system - usesudo
for this command. -
To read more about the differences between
find
andlocate
commands look here. -
You can find more details on the commands in their man pages by writing in the terminal window
man commandName
. -
When you are using
ls
command it is showing the up-to-date file status in your directory, which means it can be different fromlocate
. -
To look if your files still exist use
find
command like here.sudo find / -name filename
- or specific to your situation
sudo find / -name 19999_*
- specific to your situation
sudo find / -name 2999_*
- and so on.
-
Here is a picture with example to your specific situation:
- as you can see in the example when the file exists we can find it with
ls
,locate
andfind
commands. - after we deleted the file with
rm
command,ls
andfind
cannot find the file butlocate
command still finding the file becauselocate
using a DB screenshot.
- as you can see in the example when the file exists we can find it with