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

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

/etc/hosts

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

2 Likes

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