Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

how to create a clickable link to an executable in the terminal

+2
−0

My goal is to create a clickable link in the terminal that opens an executable. I'm trying to do this using thefile: URI. For example, I want to open Blender whose executable is /usr/bin/blender. If I enter the following in a terminal, it creates a clickable link that is recognized by the terminal. However, nothing happens when I click or Ctrl+click on it.

$ echo file:///usr/bin/blender
file:///usr/bin/blender

However, this technique does work for other file types, such as text files. For example, the following creates a clickable link to file.txt that opens with the default program to open txt files.

$ echo file:///home/trevor/file.txt
file:///home/trevor/file.txt

I can open /usr/bin/blender if I open a file browser, navigate to /usr/bin/, and double-click the blender icon.

Note: I am using Gnome and have tried this using several terminals (kgx, gnome-terminal, konsole).

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+2
−0

Since you are using GNOME, these links are probably handled by gio (as opposed to xdg-open or exo-open). GIO and xdg-open use ~/.config/mimeapps.list to figure out how to open a certain link. The file /usr/bin/blender has MIME type application/x-executable and you likely don't have a handler registered for it. If you want to run Blender by clicking on its link, add this file to ~/.local/share/applications/exec.desktop:

[Desktop Entry]
Version=1.0

Name=Exec handler
Comment=Executes its first argument
Exec=
Type=Application
Terminal=false

Then run gio mime application/x-executable exec.desktop

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

Thanks! This works for kgx and gnome-terminal, but not for konsole. Do you know why? (2 comments)

Sign up to answer this question »