Ubuntu 24.04 Created Desktop shortcut to folder to open terminal and execute a command but term. window closes

Ubuntu 24.04

Hi
I wish to create a Desktop shortcut that:

  1. opens a folder in terminal
  2. executes a command
  3. terminal stays open until I close it

Can anyone help?

Thanks
M

PS I am guessing the easiest may be to create a tiny script, if not doable directly? No idea how…

Welcome to Ubuntu Discourse :slight_smile:

Which folder and what command do you want to create a shortcut for and run in the terminal?

Hi
Thanks for your reply.

Nothing trivial, just wish to run the yabridgectl sync command in terminal, but make it a desktop shortcut.

I was not actually clear enough - sorry!

I did solve it, it is a come back to it today!!

I already added the $PATH and can run it in terminal now.
I also did set a desktop shortcut that opens terminal, runs above command - but it closes terminal window soon after it finishes and I cannot see the output.

My problem is how to keep terminal window open.

Thank you
M

PS I can make a ‘normal’ one as it is … well normal and easy.

gnome-terminal -- bash -c 'ls; exec bash'
Will do it

where should I add the above code?
I am sorry - I am a ‘old’ learner.

On the shortcut I got:
/home/user/.local/share/yabridge/yabridgectl sync

That opens terminal (because I checked the box to open terminal) does the job, and closes soon after.

You want to create a .desktop file in ~/.local/share/applications/ with the command to run and set the .desktop file key Terminal=true in it.

Though note that the terminal will always close once the app is done running regardless how you start it, so you must make sure the app does not exit at the end if you want to keep the terminal window open after the app ran …

OK
thank you all for taking the time :+1:

OK we can break this down

  1. opens a folder in terminal - which folder?
  2. executes a command - what command?