Adding A New Desktop Shortcut

Create a new text file called yourname.desktop in the /home/pi/Desktop/ directory, e.g. /home/pi/Desktop/yourname.desktop

It should contain the following:

[Desktop Entry]
Name=My Name
Comment=My application which does this


Name – The name you want displayed

Comment – Your comment

Icon – A file to use for the icon.  Your own or have a look in the /usr/share/pixmaps/ directory for something suitable.

Exec – The executable (can include sudo if your executable uses the IO). Can be the name of an executable program, or more complex, e.g. Exec=lxterminal –command "less /root/README.TXT"

Executing A Command In LX Terminal

The following will open LX terminal, wait for 5 seconds and then it will close:

[Desktop Entry]
Name=Name to be shown on desktop
Comment=My comment
Exec=lxterminal -t "Tile to display" -e sleep 5

LX Terminal will auto close once the command is complete.  You can't give more than 1 command in the -e launch options (you can't give it "-e dosomething ; sleep 5" for instance as a way to make it hold showing the result after dosomething. 

Stopping The LX Terminal Auto Closing Or Doing Multiple Things

The simple way to get round the Lxterminal only being able to take one command is to have it run a bash script.

The .desktop file

[Desktop Entry]
Name=Name to be shown on desktop
Comment=My comment
Exec=lxterminal -t "Sending Crack The Code MAIN Leader Board To Internet" --working-directory=/home/pi/projects/scripts/ -e ./ 
The .sh script


echo "Starting upload of database"
read dummy
echo "next"
mysqldump -h localhost -u user1 -p123456789 mydatabase tbl_universities | mysql -h -u user1 -p123456789 mydatabase
echo "Complete. Press return to exit"
read dummy

Remember to set the files permissions so it is executable (right click > properties in the file manager)



We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


  1. Frank Slade

    9 years ago

    Yo thanks holmes this tutorial is dope, made a shortcut for NetSurf works fine now.

  2. Daniel C Kline

    9 years ago

    For other newbies (I resemble that remark), here is a quick solution that makes life easier. I created a desktop shortcut:
    [Desktop Entry]
    Name=Python 3 – root
    comment=Integrated Development environment for Python 3
    Exec=sudo idle3

    Create it with the text editor and save it to ‘home/pi/Desktop’. I saved mine as idle3Plus. Now when it executes, it will run the ‘sudo idle3’ command to launch as a root. Then you can use the gpio libraries and debug without needing to keep s separate terminal window open.

  3. dfrag

    9 years ago

    how do you create a link to a location on the hard drive. I tried the following but it didn’t work.
    [Desktop Entry]
    Comment=Link to the www folder

    I have also tried without the Exec line and it still doesn’t work.

    1. Mc Ondo

      9 years ago

      This will open file manager into /etc

      [Desktop Entry]
      Name=Open folder
      Name[en_GB]=File Manager
      GenericName=File Manager
      GenericName[en_GB]=File Manager
      Comment=Browse the file system and manage the files
      Comment[en_GB]=Browse the file system and manage the files
      Exec=pcmanfm /etc

    2. chris owen

      2 years ago

      just find the application in file manager and, holding down cntrl, drag it to the desktop. (the cntrl button makes a copy rather than moving it

  4. Carol

    9 years ago

    it is possible to have The Pi Store downloads show up on desktop or in the Menu if I’m using Raspbian OS?

  5. gcolbourn

    9 years ago

    I’ve tried this but when I open them, they just open the text file for editing! How does it turn into a desktop shortcut?

    1. Melrick Nicolas

      8 years ago

      save it as .desktop

    2. Sr Viejo

      7 years ago

      I think the problem is that [Desktop Entry] was not included in the file text.

  6. sbignewski

    6 years ago

    Love it when stuff just works.

    Many thanks!!

  7. Olivier

    6 years ago


    Thanks for the tutorial, really helpful!

    I doing a shortcut to launch Alexa (voice assistant)
    I must have 3 different terminal windows open in order

    By now, I’, able to open it but one by one and keep it open!

    Here my file Alexa.desktop
    [Desktop Entry]
    Name=Alexa ON
    Comment=Switch Alexa ON
    Exec=lxterminal -t “Launch Alexa” –working-directory=/home/pi/Desktop/alexa-avs-sample-app/project/ -e ./

    and here my
    echo Run the web service for authorization – DO NOT CLOSE THIS WINDOW
    # open a child window, run two commands in it, and leave the child window open
    cd ~/Desktop/alexa-avs-sample-app/samples && cd companionService && npm start
    echo “keep this open”
    # leave the parent window open

    it the same for and

    How can I open 3 different terminal windows with only one shortcut?


  8. unusual computers

    6 years ago

    Thanks very much for this, found it very useful recently.
    A small correction though, you say:

    > You can’t give more than 1 command in the -e launch options (you can’t give it “-e dosomething ; sleep 5” for instance as a way to make it hold showing the result after dosomething.

    There is a way to make it execute more than one command by executing a shell and passing the commands to be executed as an argument. If you need the shell to be interactive, you can pass the shell command itself to lxterminal. For example I successfully run this:

    Exec=lxterminal -t “Installing radio rough” -e sh -c “cd ~/Desktop ; wget -O ~/Desktop/ ; sudo chmod a+x ./ ; ./ ; sudo rm ./ ; sleep 20″

    1. Adam

      6 years ago

      Thanks for the tip!

  9. CommotionWhales

    3 years ago

    Does anyone have one for reddit? Twitter,youtube,tiktok or anything like that?

  10. burner

    3 years ago

    Doesn’t exactly work for rPi Buster, gives a pop-up to select t o ‘execute’, ‘execute in terminal’, ‘open’, or ‘cancel’.

    1. LDMaughan

      3 years ago

      To stop that annoying pop-up you need to change a setting in File Manager

      1, Open File Manager
      2, Click on “Edit” on the toolbar
      3, Select “Preferences” from the drop down list
      4, Tick box that says “Don’t ask options on launch executable file”

      This took me ages to discover! haha

  11. K.R. O'Connell

    3 years ago

    excellent the comments are as good as the actual article
    years i have been looking for that answer to “burner”s question
    re Pi Buster and its annoying pop up????
    Well done everyone!

Leave a Reply to sbignewski Cancel reply

Your email address will not be published. Required fields are marked *