Linux unexpected and incomprehensive reaction

I want to update the /etc/hosts file. Below I have screenshots showing the result of the locate command which shows the existence of the /etc/hosts file, but the ls command does not show hosts. Thanks to anyone who can help me to understand this, so maybe it will help me to find the solution to access the hosts file.

the result of locate hosts shows that the file is at:


when you execute the ls command, the current working directory is /opt/lampp/etc

you can have multiple directories with the same name (etc in this case), doesn’t mean these directories have the same files

if you run:

ls /etc

you will see the host file


Thank you very much for your help. I checked with ls /etc , now I understand my mistake.
Have a nice day,