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.

ls -l

locate Downloads

  • 4
    The locate app works with a database. Therefore it leaps behind the real situation inside you PC until "sudo updatedb" is (auto) executed,
    – Whois_me
    Jun 25 at 7:48
  • 3
    It sounds your in need for some data recovery. Try the application photorec. Good luck.
    – Whois_me
    Jun 25 at 7:50
  • The principles in this answer may provide a solution askubuntu.com/questions/225814/documents-folder-missing
    – PonJar
    Jun 25 at 7:54
  • 1
    "I used mkdir to create a new Downloads folder. It was created successfully, but the files inside it are missing." That is not possible: mkdir does NOT create a directory if it exists. That would need the "rm -r" command.
    – Rinzwind
    Jul 16 at 10:25
  1. There is a difference between find, ls and locate commands.

  2. ls - list directory contents, it will show the specific directory you are "standing" at contents.

  3. 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.

  4. 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 - use sudo for this command.

  5. To read more about the differences between find and locate commands look here.

  6. You can find more details on the commands in their man pages by writing in the terminal window man commandName.

  7. When you are using ls command it is showing the up-to-date file status in your directory, which means it can be different from locate.

  8. 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.
  9. Here is a picture with example to your specific situation:

    • enter image description here
    • as you can see in the example when the file exists we can find it with ls,locate and find commands.
    • after we deleted the file with rm command, ls and find cannot find the file but locate command still finding the file because locate using a DB screenshot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.