martinrice
Posts: 21
Joined: Sun Jun 16, 2013 1:59 pm

Finding a path

Fri Jun 28, 2013 10:09 am

How do I find the path to a file?

Thanks.

Pankoi
Posts: 205
Joined: Tue Dec 18, 2012 6:59 pm

Re: Finding a path

Fri Jun 28, 2013 10:17 am

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
The Pi Store: the home of games, apps, tutorials and other content for Raspberry Pi - store.raspberrypi.com
Want to hear about new Pi Store content? Follow @PiStoreReleases on Twitter.

User avatar
joan
Posts: 14471
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Finding a path

Fri Jun 28, 2013 10:19 am

If you know the filename try

find / -name "filename"

If you know only part of the filename try

find / -name "*filename*"

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24129
Joined: Sat Jul 30, 2011 7:41 pm

Re: Finding a path

Fri Jun 28, 2013 10:23 am

Also, try the whereis command.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

User avatar
RaTTuS
Posts: 10498
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Finding a path

Fri Jun 28, 2013 10:31 am

also
which
i.e.
which ls
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

martinrice
Posts: 21
Joined: Sun Jun 16, 2013 1:59 pm

Re: Finding a path

Fri Jun 28, 2013 12:40 pm

Thanks one and all for the help. It's appreciated!

dr_d_gee
Posts: 84
Joined: Fri Jan 04, 2013 1:30 pm

Re: Finding a path

Fri Jun 28, 2013 1:18 pm

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.

User avatar
RaTTuS
Posts: 10498
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Finding a path

Fri Jun 28, 2013 1:24 pm

locate is not included in the raspbian image but you can add it
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Finding a path

Fri Jun 28, 2013 1:32 pm

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.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

Return to “General discussion”