• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Create Double-Clickable Desktop Icon To Run Terminal Commands?

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

JohnnyGalaga

Member
Joined
Nov 15, 2010
Location
USA
I’m running Ubuntu 20.04 inside of VMWare on a Windows 10 PC. I’m looking to create a desktop icon that you can double-click on to open a terminal window and run some commands. I believe this is called a “shell” file that ends in .sh? I’m new to Linux and am wondering if there’s a way to do this.
Basically, I want to double-click on a desktop icon and have it:
  1. Open a terminal window.
  2. Run cd op25/op25/gr-op25_repeater/apps
  3. Run ./multi_rx.py -c hillsboroughwest.json -T hillsboroughwest.tsv -U -l http:0.0.0.0:8080 2> stderr.2 -X (this is a software application with command line arguments).
  4. Open a 2nd terminal window.
  5. Run cd op25/op25/gr-op25_repeater/apps/oplog
  6. Run ./oplog.sh (another software application that works with the first one).
This is basically for convenience so as not to have to manually do all those steps everytime. Thanks.
 
You can open a terminal in your Linux VM with the keyboard: ctrl + alt + t, or use the menu to find the terminal icon, which BTW can be placed on your Linux desktop as well.

Your .bash_history is stored in your home directory, you can use the up /down arrow keyboard keys to recall previous commands. I use that all the time, not wanting to type the same lines over and over. Although using "./" you've installed that software and wouldn't have to repeat that operation, unless I'm missing something.
 
Last edited:
To add to Tim's excellent points you can make it a single click...not a double. I remember when years ago the memory of your past commands would get wiped on a reboot. Not sure if it stores them in a VM when Win reboots?
 
Yes, the up / down arrows do recall previous commands that were run in the terminal, even after re-booting. But actually, what I was hoping for was a way to create a desktop icon that is a text file that you can simply double-click on to run commands. For example, here's a file on the desktop I created call test.sh:

dfgjhjh.PNG

Problem is, when I double-click the icon, it does nothing. It won't actually run the commands I've got in the file. In fact, it doesn't even open at all unless I right-click and choose Open With Other Application. I already have the box checked to Allow executing file as a program.
 
Old post, but it already looks executable from the screenshot. I'd make a few changes to that shell script, though:

Code:
#!/bin/sh
/absolute/path/to/op25/op25/gr-op25_repeater/apps/multi_rx.py -c hillsboroughwest.json -T hillsboroughwest.tsv -U -l http:0.0.0.0:8080 2> stderr.2 -X
/absolute/path/to/op25/op25/gr-op25_repeater/apps/oplog.sh

Note I'm using absolute paths. No having to change directory & it works wherever you put it. You can also chmod 755 if you wanted to make it viable for other app 'users' to run should you want to insert it anywhere else. Otherwise 700 is good.
 
Back