30

I'd like to copy the current link to the system's clipboard or write it to a file.

If it isn't possible, I guess I'd have to settle with opening it in an external browser (which I was avoiding in the first place, thus using Lynx), and then copying the opened URL. :-/

4 Answers 4

31

Press Shift+g to show the address of the current document, Shift+e to show the address of the selected link. You can copy the text with your mouse (or the keyboard, if your terminal supports that).

Press a to save the address of a document or link to a (Netscape-alike) bookmark file, by default ~/lynx_bookmarks.html. You can open this in a different browser, it's just HTML.

5
  • 2
    This works like a charm - thanks! I was wondering, though, what about links that are too long to fit in the status bar? How do I select/copy those (without having to save it to the bookmarks file and copy it from there)? Jun 21, 2017 at 16:26
  • ① Scroll with the arrow keys left and right and copy the URL in pieces. Needs assembly in a text editor or similar. ② Resize the terminal emulator window and reduce the font size to minimum. Can fit about 350 characters for the displayed URL with my setup. Assign some keyboard shortcuts if you need to do this often.
    – daxim
    Jun 22, 2017 at 14:18
  • 2
    I know this is old, but you can press L to show a list of all of the links on a page untruncated, and use the previously mentioned methods to copy it. Although, when you copy it there will be newline and padding characters if the link spans more than one line.
    – K. S.
    Jul 3, 2017 at 15:41
  • tmux can be used for copying text on Linux (on Wayland copy to the system clipboard with e.g. wl-clipboard.
    – user198350
    Feb 18, 2023 at 16:12
  • Same works in elinks, just the bookmarks file is located in~/.elinks/bookmarks
    – Hritik
    Jul 16, 2023 at 20:28
2

Sorry I am a bit late to this post, but I just saw this question. You can use the EXTERN_PAGE (default: ,) or EXTERN_LINK (default: .) keys to do what you want with the page url or selected url respectively. In the config you will also have to include something like EXTERNAL:http:echo %s | xclip -selection clip-board:TRUE into your config if using xorg to define a copy command. Of course, you can also use this for other commands like EXTERNAL:http:mpv %s:TRUE if you want to watch something directly.

I hope this helps anyone searching this thread.

1

Apparently, you can also use Ctrl + S to save the URL of the current page or the current link (at least on my version 2.8.8).

(Unfortunately, I'm currently getting an error "Copy to clipboard failed", but maybe someone else is more lucky.)

2
0

A simpler one-key solution is = which displays Document Info and where you may also right-click to copy link.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .