Desktop shortcut for terminal command

133,630

Solution 1

Right click the desktop and create an empty file (or use gedit) named easytether.desktop. Paste this into this file:

[Desktop Entry]
Name=Easytether
Exec=easytether connect
Terminal=true
Type=Application

and save! You will then need to make the file executable, by editing the properties of the file, or running: chmod +x easytether.desktop.

  • The Name=Easytether line specifies the name of the shortcut that will appear to the user.

  • The Exec=easytether connect line specifies the command to be run, in this case, easytether connect.

  • The Terminal=true line specifies that the command should be run in GNOME Terminal, so that the user can inspect its output. You can later set this to false if you don't want the shortcut to open a Terminal window. For instance, if you made a shortcut to the "sound" panel of the "settings" and want it to only open that (the command would be "gnome-control-center sound").

  • You can even add a line Icon=path/to/png/ (or Icon=iconname and put your iconname.png in ~.local/share/icons) in order to add a custom icon to your launcher.

Also, you can put the easytether.desktop file into ~/.local/share/applications and start it from Dash or other app-launcher (Synapse, Kickoff, Slingshot etc).

Solution 2

I found this worked best for me, I'm on Ubuntu 14.04 LTS

First, create a blank file on the desktop, name it Terminal.desktop (or anything-you-want.desktop)

Open the file with your preferred text editor (gedit, vim, nano, etc.) and paste/type-out the following:

[Desktop Entry]
Version=0.99
Name=Terminal
Comment=Terminal Desktop Shortcut
Exec=/usr/bin/gnome-terminal
Icon=/usr/share/app-install/icons/terminal-tango.svg
Terminal=false
Type=Application
Categories=Application

Save and quit.

I know I know, the icon doesn't look right yet, don't worry! Right click the file, select Properties, go to the Permissions tab, and tick 'Allow executing file as program'.

Alternatively, you can use chmod 775 Terminal.desktop or chmod +x Terminal.desktop to give it execute permissions using the terminal if you prefer terminal commands (when you are in ~/Desktop).

N' ta-da! That's all, really simple, looks pretty and works well too :)

Solution 3

The easiest way, that is also useful in other platforms, would be:

  • Right click->Create new document->Empty document
  • Call it howeverYouWant.sh
  • Open it, and edit it writing in each line each line you'd use in the terminal, ergo: "easytether connect"
  • Right click it->Properties->Permissions->Allow executing
  • Double click the file, and choose Run in terminal

Solution 4

Right click desktop and choose create Launcher.

Enter this in the command:

exo-open --launch TerminalEmulator

Save it with a name and icon of your choice, and do NOT select "Run in terminal"

Solution 5

Kudos to efaj, whose answer got me halfway there. For those who are still stumped, this should get you over the finish line:

  1. Create an empty document, probably on the desktop, called something.sh (change the italicized part to whatever you want, but make sure the extension is .sh).
  2. Edit the document and enter a series of terminal commands, one on each line, to accomplish your task. It's likely you'll want the first line to be a "cd" command that changes the active directory in the terminal session that will be launched.
  3. Double-click the new document file.
    • If it launches, you're all done.
    • If you get a dialog that asks if you want to run the file or display its contents, choose the "Run in Terminal" option.
    • If the file opens in an editor, or you want to always run .sh files but you got the dialog mentioned above, open Nautilus (a.k.a. Files) and choose "Edit-Preferences" from the menu, then click the "Behavior" tab. In the "Executable Text Files" section, you can choose whether to run .sh (and other executable text type) files, view them, or ask what to do when you launch them.
Share:
133,630

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I was wondering how to make a clickable terminal shortcut for my desktop using the command easytether connect.

    I don't want to have to open/close the terminal every time I wish to connect to the Internet through my phone.

    I've tried updating my gnome-panel but I can only make a new directory on my desktop.

    • Admin
      Admin over 11 years
      do you mean create Terminal Shortcut on desktop or embed terminal on desktop?
    • Admin
      Admin over 5 years
      BTW, you may like Guake terminal. It's Quake-like terminal which appears/disappears with F12 (or any other) key. Personally, I use it a lot if I need to install some package or execute some useful alias.
  • Aquarius Power
    Aquarius Power about 11 years
    it worked thx!! ubuntu 12.10, btw, if you want to drag/drop at cairo-dock, it will fail but the cairo dock launcher has a gui to edit its fields so it is not a big problem :)
  • Vignesh
    Vignesh over 3 years
    This worked on Ubuntu 20.