Create hyperlinks in the terminal
iTerm2, bash, tips & tricks
May 11, 2023
I recently wondered how to create hyperlinks in the terminal and found a way that worked for me in iTerm2 on Mac OS. You can create clickable links with this clever command:
echo -e '33]8;;'"${url}"'a'"${link_title}"'33]8;;a'
You declare $url
and $link_title
, and the output is this beauty:
This method does not work in all terminals. For other terminals try this one:
echo -e 'e]8;;http://example.come\This is a linke]8;;e\'
That didn’t work for me personally. This example is taken from this document. But I didn’t manage to create a link in this way neither in iTerm2, nor in the standard terminal. Maybe all these methods are specific for different terminals.