Find all .desktop files in my system – failed

Tony Arnold tony.arnold at manchester.ac.uk
Sat Nov 10 09:49:55 UTC 2012


Johnny,

On 10/11/12 08:59, Johnny Rosenberg 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
> ~$
> 
> But, in /usr/share/applications/ there are loads of .desktop files.
> Why are they not found?
> 
> Then I tried this:
> ~$ cd /usr/share/applications/
> applications$ sudo find . -iname *.desktop 2>/dev/null
> applications$
> 
> Then:
> applications$ sudo find . -iname *.desktop
> find: paths must precede expression: anjuta.desktop
> Usage: find [-H] [-L] [-P] [-Olevel] [-D
> help|tree|search|stat|rates|opt|exec] [path...] [expression]
> applications$
> 
> I am not sure I understand the error message. Path must precede
> expression, yes, but isn't that exactly the case?
> 
> Confused…

You need to escape the * int he name part or put the name part in
quotes. Otherwise, the shell will epand the wild card and pass the found
names to find which is not what you want. Thus:

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

Regards,
Tony.
-- 
Tony Arnold,                        Tel: +44 (0) 161 275 6093
Head of IT Security,                Fax: +44 (0) 705 344 3082
University of Manchester,           Mob: +44 (0) 773 330 0039
Manchester M13 9PL.                 Email: tony.arnold at manchester.ac.uk




More information about the ubuntu-users mailing list