I'm new to linux. And I'm just exploring terminal.
- I created a file
touch Desktop/vvv
. - Now I updated the database using
sudo updatedb
. - The command
locate vvv
doesn't shows any result. While it just works fine withfind / -name vvv
.
I have found that is that locate
doesn't seem to search in my home directory, as it shows results from usr
, var
, slib
, opt
, etc. directories.
Why I'm saying this is because when I try to locate
some random file like complete
which is in Download directory (which is not quite a unique name), it will show results from other directories but not Download.
Update: To demonstrate this, I've copied this from terminal:
aditya@ubuntu16:~$ cd /usr/
aditya@ubuntu16:/usr$ ls
bin games include lib local locale sbin share src
aditya@ubuntu16:/usr$ sudo touch aaaa
[sudo] password for aditya:
aditya@ubuntu16:/usr$ ls
aaaa bin games include lib local locale sbin share src
aditya@ubuntu16:/usr$ sudo updatedb
aditya@ubuntu16:/usr$ locate aaaa
/usr/aaaa
/var/cache/fontconfig/0bd3dc0958fa2205aaaa8ebb13e2872b-le64.cache-6
aditya@ubuntu16:/usr$ cd ../home/aditya/Desktop/
aditya@ubuntu16:~/Desktop$ touch aaaa
aditya@ubuntu16:~/Desktop$ updatedb
updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db'
aditya@ubuntu16:~/Desktop$ sudo updatedb
sudo: unable to resolve host ubuntu16
aditya@ubuntu16:~/Desktop$ locate aaa
/usr/aaaa
/usr/share/app-install/desktop/jaaa:jaaa-alsa.desktop
/var/cache/fontconfig/0bd3dc0958fa2205aaaa8ebb13e2872b-le64.cache-6
/var/cache/fontconfig/bab58bb527bb656aaa9f116d68a48d89-le64.cache-6
aditya@ubuntu16:~/Desktop$