Find all .desktop files in my system – failed

Chris Green cl at
Sun Nov 11 12:42:37 UTC 2012

On Sat, Nov 10, 2012 at 09:21:21PM +0000, Colin Law wrote:
> On 10 November 2012 08:59, Johnny Rosenberg <gurus.knugum at> wrote:
> > I'm not sure what I'm doing wrong here (I am a beginner too, since a
> > few years back…), but obviously I misunderstood the find command
> > completely:
> > ~$ sudo find / -iname *.desktop 2>/dev/null
> > /home/guraknugen/examples.desktop
> > /home/video/examples.desktop
> > /etc/skel/examples.desktop
> > ~$
For that to work in every case you need:-

    $ sudo find / -iname '*.desktop' 2>/dev/null

because if there happens to be a file that matches *.desktop in the
directory from which you are running the find the  it gets expanded by
the shell and the find won't do what you want/expect.

> You can also try
> locate .desktop
That will find a lot more than you want, it will return every single
file within a directory hierarchy whose top level directory matches
*.desktop.   This is so rarely what one needs that I'm amazed it's the
default for locate.

Chris Green

More information about the ubuntu-users mailing list