Take the 2-minute tour ×

One of my most common tasks is:

1) Open a bunch of tabs

2) Copy and paste the URL from the address bar, as well as the body text, of each open tab into a text editor

Is there a way to script this from the Linux shell, even though I'm browsing in the GUI?

I get tired of having to do it all the time.

share|improve this question
Can you be more specific about what you're trying to do? Are the URLs in the address bar or in the body of the page? It might make a difference what browser you're using. The usual way to script retrieval and parsing of web pages is to start by retrieving the page using curl or wget. You don't say which operating system, but your use of the word "shell" seems to imply Linux/Unix. Please see How to Ask and How To Ask Questions The Smart Way. –  Dennis Williamson Jan 31 '11 at 15:29
@Dennis Williamson done –  ixtmixilix Jan 31 '11 at 23:09
add comment

1 Answer

up vote 0 down vote accepted

One possibility, if you don't mind downloading the same URLs twice, is to do something like this:

#!/bin/bash -e
for url in 'http://www.example.com/foo/bar.html' \
       # and so on
    firefox "$url"   # or whatever browser you want that is set to open
                     # links in a new tab
    echo "$url" > $TMPFILENAME
    lynx -dump "$url" >> $TMPFILENAME
    kate $TMPFILENAME &  # or any other text editor that is set to open
                         # files in a new tab
share|improve this answer
add comment

Your Answer


