-   Linux - Newbie (
-   -   Find a directory (

shik28 09-19-2011 05:21 AM

Find a directory
I am logged in as shik28 to a remote system. I have to locate a directory /log in it.

But when I hit ls in the root directory, it does not display /log anywhere. But when I say cd /log there is no error. How to find where exactly /log is present?

hi2arun 09-19-2011 05:48 AM

By 'root directory', do you mean '/root' or '/'?

shik28 09-19-2011 05:51 AM

@hi2arun: I meant home directory. What is the difference between /root and /?

samtoddler 09-19-2011 05:57 AM


where you have executed ls command in the /root (which is home of superuser directory) or / (which is the filesystem root.
make sure where you trying to find out the directory.


in the exact directory

or may be there are situations where you have mounted a filesystem but after reboot it's not mounted.


shik28 09-19-2011 06:16 AM

The command is not executed in superuser directory. It is executed in user's home directory.

repo 09-19-2011 06:25 AM


It is executed in user's home directory.

cd /log
the "log" directory is a subdirectory from "/"
When you are in

ls will show the files and directories from "/home/user"
To see the files/directories from "/",
you need to be in the "/" directory

cd /

Some info on the linux file system:

Kind regards

linux1986 09-19-2011 06:26 AM


Check where you are


you can check the location of log dir using following command

find / -type d -name log

shik28 09-20-2011 12:21 AM

@repo and @linux1986: Thanks a lot! :)

All times are GMT -5. The time now is 06:04 PM.