Page 1 of 1

Finding a path

Posted: Fri Jun 28, 2013 10:09 am
by martinrice
How do I find the path to a file?

Thanks.

Re: Finding a path

Posted: Fri Jun 28, 2013 10:17 am
by Pankoi
If you're in a terminal and in the same directory as the file, you can type 'pwd' to get the path to the current directory and then you should just be able to stick the filename on the end, if that's what you mean? :)

Hope that helps,
~Richard Williams

Re: Finding a path

Posted: Fri Jun 28, 2013 10:19 am
by joan
If you know the filename try

find / -name "filename"

If you know only part of the filename try

find / -name "*filename*"

Re: Finding a path

Posted: Fri Jun 28, 2013 10:23 am
by jamesh
Also, try the whereis command.

Re: Finding a path

Posted: Fri Jun 28, 2013 10:31 am
by RaTTuS
also
which
i.e.
which ls

Re: Finding a path

Posted: Fri Jun 28, 2013 12:40 pm
by martinrice
Thanks one and all for the help. It's appreciated!

Re: Finding a path

Posted: Fri Jun 28, 2013 1:18 pm
by dr_d_gee
If locate is installed (can't remember whether it is or not in the default Raspbian image) then

Code: Select all

locate filename
will work. It uses a database of files so can produce results very quickly. If the database is not up-to-date you may need to do

Code: Select all

sudo updatedb
first.

Re: Finding a path

Posted: Fri Jun 28, 2013 1:24 pm
by RaTTuS
locate is not included in the raspbian image but you can add it

Re: Finding a path

Posted: Fri Jun 28, 2013 1:32 pm
by Joe Schmoe
locate is not included in the raspbian image but you can add it
True.

And this is completely absurd. locate should be standard.

Pretty much the first thing I install on any new RPi image.