Browsing the Internets from the terminal
Posted: April 24th, 2010 | Author: Tobias | Tags: internet, links2, web browsing
Note: Code lookslike this, and key presses look When I installed a version of Linux on my desktop, I played around with the bootloader and accidentally broke it. Thankfully I had my handy hacked Zipit Z2 to let me search online. At the moment, I didn’t have a graphical browser, so I used the awesome text browser: Links2. I’ll show you how to install it, and the basic commands to get around online. (Links2 is a dual-mode browser: If I’m inside an X environment, it will display graphics, but from the console it won’t.)
I’ll probably end up getting familiar with other Linux system commands after a while, but for now I’ll only be able to provide instructions for Debian systems, and in Debian Links2 is already in the repository, so nothing special is required: sudo apt-get install links2
sudo You’ll need to have admin rights to install thingsapt-get This runs the program “apt-get”, which is what most Debian installs use to access the repository of programs. You could also use aptitude if you have it installedinstall This is the “flag” to pass to the program “apt-get”, which will tell it to go ahead and install a program.links2 This is the program to installWhile I don’t use it, the Fedora/RedHat systems installation appears to be a little more involved, judging from this post (has instructions).
Once Links2 is installed, you can access it from the terminal using this structure: links2 [options] URL (If you don’t specify a URL, Links2 will open to a blank page. Access the menu by pressing Esc)
The [options] you can use are as follows (this list is basically from the links2 --help readout, but explained a bit more):
-gThis runs Links2 in graphics mode. You may be able to browse with graphics without starting X, I already had it installed so I’m not sure what it references.-no-gIf you are in X it will default to display graphics, but this will tell it to revert to text only.-sourceThis one has to be right before the URL (eg.,links2 -source URL). It will output the text source code of the page instead of rendering it as HTML.-force-htmlIf a page isn’t understood by Links2, it might not display as HTML, this will force it to try.-dumpThis one also has to be right before the URL. It will render the page as HTML and dump it to the screen, so the program won’t be running.-fake-user-string [string]The browser tells the website you visit what browser you are using, that way the server can give you a page ideally constructed for your browser. There is a huge list of strings at this link.
There are actually piles and piles of different options you can change, but if you want to make something permanently changed, you should change the configuration file for Links2, which is located in the file links.cfg
If you installed Links2 in a Debian environment, you can probably find the configuration folder using: cd $HOME/.links2
cd This is the command to change directories$HOME This is a shortcut (it must be typed in capital letters) to the home directory of the current user, it’s really handy/.links2 A dot in front of a file or folder hides it—most configuration files are hiddenMake sure to make a backup copy of the configuration file before you change anything! A sample one can be found here, if you want to look at it.
Start up links2 and go somewhere like Life Hacker (notice that Links2 doesn’t require the “http://” prefix): links2 lifehacker.com
Navigation in Links2 is with keyboard shortcuts, the most important ones being these:
I have taken rather fondly to the text-only browser — I’m trying to get Facebook and the WordPress admin page to load correctly, that will be awesome!
THANK YOU. IMHO.
links2 is better than elinks.
Can use in bash script. Some
different ‘time delay on elinks’,
but not on links2.
For the record, I mostly use Links2 because I find it intuitive, fast and stable, because I prefer using the d-pad and buttons for navigation, and because I’ve had ALL THREE of the editor’s picks (Firefox, Chromium and Midori 0.3.3) crash on me while I was using them. For Midori, details here:http://www.gp32x.com/board/index.php?/topic/59121-midori-0-3-3/page__view__findpost__p__948198I feel like the previous (“fixed”) version of Midori may have been more stable than this latest one, or at least that one never crashed for me, even though the interface of this new one is better overall.I have a kind of browser hierarchy:Links2 for most things (including email and posting on forums)Midori for slightly more complex things (such as download sites with timers)Firefox for when I absolutely need Flash. It’s the only browser that has ALL the features of a modern desktop browser.