Home » Linux » finding a file on linux? [closed]

finding a file on linux? [closed]

Posted by: admin November 30, 2017 Leave a comment

Questions:

I am trying to find where index.html is located on my linux server, and was wondering if there was a command to do that. Very new to linux and appreciate any help I can get.

Answers:

Find from root path find / -name "index.html"

Find from current path find . -name "index.html"

Questions:
Answers:

The below line of code would do it for you.

find / -name index.html

However, on most Linux servers, your files will be located in /var/www or in your user directory folder /home/(user) depending on how you have it set up. If you’re using a control panel, most likely it’ll be under your user folder.

Questions:
Answers:

Try this (via a shell):

update db
locate index.html

Or:

find /var -iname "index.html"

Replace /var with your best guess as to the directory it is in but avoid starting from /

Questions:
Answers:

find /the_path_you_want_to_find -name index.html

Questions:
Answers:

In general, the best way to find any file in any arbitrary location is to start a terminal window and type in the classic Unix command “find”:

find / -name index.html -print

Since the file you’re looking for is the root file in the root directory of your web server, it’s probably easier to find your web server’s document root. For example, look under:

/var/www/*

Or type:

find /var/www -name index.html -print