4 ms·
See also: ls --hyperlink With a compatible terminal you can then just click on results. Another nicety is making your shell prompt a link to the working dir
by aendruk 4y ago
See also:
ls --hyperlink
With a compatible terminal you can then just click on results. Another nicety is making your shell prompt a link to the working directory.
Haven’t seen a terminal that lets you drag the links but that sounds like a logical feature.
- puppybang 4y agoSadly not all terminals have a great support for ls --hyperlink. Here is a quick comparison if anyone needs: https://github.com/asdf8dfafjk/Terminal-Features/blob/main/Features.md https://github.com/asdf8dfafjk/Terminal-Features/blob/main/F... Wish some terminals would allow more "actions" on hyperlinks, maybe using right click, and even drag-drop
- sime2009 4y agoWhat other actions do you have in mind? "copy path" and "open in default app" are the most obvious ones.
- ddlsmurf 4y agoiTerm2 has great build in support for it. You just cmd-click and hold a file and it's as if it was sourced from any other ui app. You can even get it to work with remote files both ways, including dropping a file on an iTerm2 window during an ssh session and it can scp it over for you. (yes needs some shell collaboration, but it's trivial to setup)
- codesnik 4y agoWow, thank you. I didn't know about dragging, I always resorted to "open -R" to drag a file to anything GUI.
- ddlsmurf 4y agoDefinitely have an in depth read of iTerm2's documentation (<https://iterm2.com/documentation.html https://iterm2.com/documentation.html>), at the very least one of the feature page (<https://iterm2.com/features.html https://iterm2.com/features.html>) - I know it sounds weird, but it's so far ahead of other terminals that it's hard to imagine, and expectations are blown. The trigger feature for example is fantastic too.
- chrismorgan 4y agols --hyperlink is completely broken for me, because it’s producing links of the form file://hostname/path rather than file:///path, and xdg-open says “xdg-open: file 'file://hostname/path' does not exist”.
- pmontra 4y agoWhat if you control click on the hyperlink?
- chrismorgan 4y agoIrrelevant. I’m using Alacritty, which is set to use xdg-open, and xdg-open isn’t liking the URL form, as demonstrated by running it directly.
- pmontra 4y agoSorry to hear that. xdg-open and those URLs work in my Ubuntu 20.04 and Control click works in my Gnome Terminal.
- morsch 4y agoI also get file://hostname/path urls, but opening them works fine. xdg-open 1.1.3 Ctrl-clicking opens the link, but is anything supposed to happen when I click on the link (in Gnome Terminal). I thought it might copy the link, but nope.
- chrismorgan 4y agoPerhaps Gnome Terminal is using gio open instead of xdg-open. Running `gio open file://something-else/home` opens /home, apparently just completely ignoring the authority part. Theoretically including the host name is good because you can handle remote machines, but in practice I’m not sold on it because here we have one major tool ignoring it (actively bad!) and another major tool not supporting it (less bad, but less convenient), and there’s no standard accepted way of interpreting/opening a file: URL with an authority anyway. (Windows treats it as SMB and can do something provided it actually is that, but it won’t be, so it can’t. I don’t know of any other OS having any convention at all. Just tried it in a couple of browsers under Linux, Firefox actively discards the authority part, Chromium keeps it and works if it’s localhost or 127.0.0.1 or such, but says ERR_INVALID_URL if it’s something else.)
- runlevel1 4y agoExplanation of how `ls --hyperlink` works and how to create links in the terminal: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3c...
- pmontra 4y agoThanks! I almost don't need a graphical file manager anymore.
- kwhitefoot 4y agoThank you!
- codetrotter 4y agoNeat! Here’s a blog post with more details https://purpleidea.com/blog/2018/06/29/hyperlinks-in-gnome-terminal/ https://purpleidea.com/blog/2018/06/29/hyperlinks-in-gnome-t...
- RockRobotRock 4y agoTempleOS has had this for years