How to create a launcher to execute a terminal command?

Solution 1:

Well you could create a new document on your Desktop, name it something.desktop like ping1.desktop

Then put this in, Name= & Icon= lines can be whatever you want (usually best to full path Icon=) or you can leave Icon= blank

[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Exec=ping www.google.com
Name=whatever you want
Icon= 

After creating right click on the launcher > Properties > Permissions > & check the Execute: box

(- you could also extend it's use to other pings if you use in unity's launcher via added quicklist entries in the .desktop

Solution 2:

It took me a while to understand this because I'm a total Ubuntu beginner. Eventually, I figured it out:

  1. Right click on desktop. From the pop-up menu select "New Document", then "Empty Document".

  2. Name the document something.desktop, where "something" is replaced by the name you want.

  3. Open the document with gedit (usually just by double clicking).

  4. In gedit paste the following in, where "whatever you want" is the name of the launcher you choose, and where "path to icon", is the path to the icon you want, i.e. the directory location of the icon image:

    [Desktop Entry]
    Version=1.0
    Type=Application
    Terminal=true
    Exec=ping www.google.com
    Name= whatever you want
    Icon= path to icon
    
  5. After creating, right click on the launcher, go to Properties → Permissions, and check the Execute box.