29

I am creating Log-Reports which are viewable through the Web-browser. Is there an easy way to make links clickable in Linux Terminal? (Gnome-Terminal)

I am copying those links and manually open my web-browser to achieve that right now.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
user1767754
  • 427
  • 1
  • 4
  • 5

2 Answers2

40

Newer version of GNOME terminal now support hyperlinks with custom target via certain escape sequences. Try

echo -e '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\'

Opening these works the same way as described in the answer by Stephen Kitt.

See also: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

egmont
  • 5,555
  • 1
  • 21
  • 28
alphanum
  • 821
  • 7
  • 9
22

If the links are output as full URLs, they should be clickable when you hover over them (with the mouse pointer) while holding Ctrl down.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • @user1767754 Forthcoming gnome-terminal 3.26 will support web-style hyperlinks, that is, where the visible text is potentially something entirely different from the target URL. And there's even a patch for the `ls` utility. See https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda. – egmont Aug 11 '17 at 19:25
  • @ibrahim5253 yes, this is possible at least in Ubuntu. You just need to prepend `file://` to the fully qualified path of the file. Unfortunately, a relative path cannot be supplied, only a fully qualified path though. – Matan May 20 '18 at 05:48
  • This also works for macOS with the cmd key – RenRen Feb 11 '22 at 14:22