Desktop shortcut for terminal command
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/
(orIcon=iconname
and put youriconname.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).
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
orchmod +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 :)
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
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"
Kudos to efaj, whose answer got me halfway there. For those who are still stumped, this should get you over the finish line:
- 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).
- 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.
- 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.