Browsing the Internets from the terminal
Summary:
Links2 is a text-based web browser that can be run from the terminal, but also has the ability to display graphics. In Debian the installation is simple, since the application is in the repositories. Shortcut keys and additional options are shown.
Posted: April 24th, 2010 | Keywords: internet, links2, web browsing
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!