LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Find a directory (http://www.linuxquestions.org/questions/linux-newbie-8/find-a-directory-903807/)

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

Hi,

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.

execute
Code:

ll
in the exact directory

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

samtoddler

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

Code:

It is executed in user's home directory.
Quote:

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

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

cd /
ls

Some info on the linux file system:
http://www.thegeekstuff.com/2010/09/...tem-structure/
http://www.debianadmin.com/linux-dir...-overview.html

Kind regards

linux1986 09-19-2011 06:26 AM

Hello,

Check where you are

#pwd

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 11:55 AM.