ubuntuaptlocate

ubuntu: locate command is return wrong resutls


Here is complete scenario:

dev@ubuntu:~$ locate php.ini
/etc/php/5.6/apache2/php.ini
/etc/php/5.6/cli/php.ini
/etc/php/7.2/apache2/php.ini
/etc/php/7.2/cli/php.ini
/home/dev/htdocs/mweb-centralhubapi/vendor/doctrine/cache/tests/travis/php.ini
/home/dev/htdocs/mweb-centralhubapi_old/vendor/doctrine/cache/tests/travis/php.ini
/home/dev/htdocs/mweb-environment-status/vendor/doctrine/cache/tests/travis/php.ini
/home/dev/htdocs/mweb-jobsapi/vendor/doctrine/cache/tests/travis/php.ini
/mnt/hgfs/mweb/mweb-data/vendor/doctrine/cache/tests/travis/php.ini
/mnt/hgfs/mweb/testCaces/vendor/doctrine/cache/tests/travis/php.ini
/usr/lib/php/7.0/php.ini-development
/usr/lib/php/7.0/php.ini-production
/usr/lib/php/7.0/php.ini-production.cli
/usr/lib/php/7.2/php.ini-development
/usr/lib/php/7.2/php.ini-production
/usr/lib/php/7.2/php.ini-production.cli
dev@ubuntu:~$ sudo rm /etc/php/5.6/apache2/php.ini
rm: cannot remove '/etc/php/5.6/apache2/php.ini': No such file or directory

When I try to remove the file It says: No such file


Solution

  • switch to root user by command :

    su - root
    updatedb
    

    I hope it will work.