Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to find settings.xml file in my Ubuntu machine. I have no clue where it is, and which directory it is in.

I tried using this -

ls -R | grep settings.xml

But it doesn't show me the full path where it is.. Is there any other command which I need to try that can give me the full path?

share|improve this question
Whenever you think the solution is to parse the output of ls, you are almost certainly doing it the wrong way. – terdon Feb 11 '14 at 0:38
up vote 14 down vote accepted

For fast search (but not definitive):

locate -br '^settings.xml$'

From man locate:

   locate  reads  one or more databases prepared by updatedb(8) and writes
   file names matching at least one of the PATTERNs  to  standard  output,
   one per line.

   -b, --basename
          Match  only  the base name against the specified patterns.  This
          is the opposite of --wholename.
   -r, --regexp REGEXP
          Search for a basic regexp REGEXP.  No PATTERNs  are  allowed  if
          this  option  is used, but this option can be specified multiple

The ^ and $ ensure that only files whose name is settings.xml and not files whose names contain settings.xml will be printed.

You may need for the first time to run: updatedb (as root) to update/build the database of locate.

share|improve this answer
@terdon, you surprised me, I have never though about looking to man locate before!!! assuming it just simple search tool. Thank you very much. – Sneetsher Feb 11 '14 at 0:46
Yes, that was pretty much my reaction the first time I read the man page :) – terdon Feb 11 '14 at 0:47
it is worth noting the role of updatedb for this command -- locate often fails without that, for me, anyways – rm-vanda Feb 11 '14 at 0:55
@rm-vanda, I've updated the answer to mention updatedb. Thank you. – Sneetsher Feb 11 '14 at 1:07
locate '*/settings.xml' is probably more portable among the various different implementations of locate (where available). – Stéphane Chazelas Feb 26 at 22:23

A slow but steady search through file-system, but Definitive.

find / -xdev -name settings.xml

It will take some time and you may get some permission errors but it will get there. If you've got some more idea where it may be located change the first directory from / to /where/you/guess

share|improve this answer
Appending 2>/dev/null to the end of the command will suppress all of the error output (by redirecting stderr to the null device). – Tanner Swett Feb 12 '14 at 18:43

tree is another good way, if you aren't sure exactly what you're looking for, and it seems to be a bit faster- :

tree -f / | grep settings.xml

Other useful flags: -i on grep will ignore the case, -h for human readable on tree --

-- the man page has a lot of useful options -!

share|improve this answer
Not a good idea, tree(1) shows an ASCII-art tree of the files, which is then mutilated by grep(1). – vonbrand Feb 11 '14 at 1:24
Yes, if you're going to use tree, you may as well use find . type -f which will be faster. – terdon Feb 11 '14 at 1:29
OK, good tip -! – rm-vanda Feb 11 '14 at 3:49


$ locate settings.xml
share|improve this answer
Upgrade, Fedora 18 is end-of-life. – vonbrand Feb 11 '14 at 1:22
It works. That's all that matters. – octopusb Feb 11 '14 at 1:57
Until you get pwnd, or you want to install some new piece of software. – vonbrand Feb 11 '14 at 2:02

X Tian's answer is ok but as pointed out it's slow. Just run

find / -name settings.xml
share|improve this answer
Yours will be even slower... – don_crissti Feb 26 at 20:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.