I created a simple desktop file to check the connectivity of remote location in which Exec=ping 192.168.0.9
. But one file created with #!/usr/bin/env xdg-open
before Desktop Entry and another without #!/usr/bin/env xdg-open
and both worked the same. Then What is the use of it in desktop file? What does it mean?
As per this answer , the use of
#!/usr/bin/env xdg-open
was meant to serve as a way to launch applications that referenced in.desktop
file via command line. But as of now, it doesn't work and only opens.desktop
file as text file ingedit
. Nowadays , if you want to launch a.desktop
app via command line, you must do some pre-processing of the file itself.As for use of
#!
it basically tells your computer which interpreter to use with this file. In this case,/usr/bin/env
which will return path toxdg-open
command (i.e, this callsxdg-open
to read and execute your file ) .