Although graphical user interface (GUI) has almost become synonymous with personal computing these days, systems still exist that only offer command line interface (CLI). Even if you don’t use these CLI-based systems, sometimes when you’re troubleshooting a problem, you have to switch your system to command line mode.
What if there’s a need to access the Internet when your system is running in command line mode? Are there any tools that let you quickly browse the Web from the command line? Thankfully, the answer is yes, with one such tool being the Lynx Web browser, and we’ll be discussing it in this article.
While its official documentation describes it as a “WWW client for users running cursor-addressable, character-cell display devices,” Lynx – in layman’s terms – is an open source Web browser that lets you access websites from the command line. Being command line-based, the tool only displays the text part of a Web page, although it can be configured to open any images or videos through an external program.
The browser came into existence way back in 1992, making it the oldest Web browser currently in general use and development.
Download and Install
Downloading and installing Lynx is easy on Ubuntu – all you have to do is run the following command:
sudo apt-get install lynx
The above command installed version 2.8.9dev.8 on my system. In case you don’t want to settle for anything less than the latest available version, you can easily fetch it from the tool’s official website.
Once installed successfully, you can launch the Web browser by running the following command in terminal:
This will open the browser’s official website on the command line.
As you can see, the text portion of the website is displayed by Lynx. Here, the words or text snippets highlighted in green color are actually hyperlinks. Pressing the up/down arrow keys on your keyboard will automatically take you to the previous/next hyperlink. To follow a link, either press Enter or the right arrow key.
Lynx also displays a list of common commands at the bottom of the screen, which is especially helpful for new users.
To open a specific website, run the Lynx command followed by the website URL as argument. For example, here’s how you can open Google in the Web browser:
To find a word on the webpage opened in Lynx, press the ‘/’ key, enter the keyword, and then press Enter. In the same way, to bookmark a page, press the ‘a’ key, followed by ‘d.’ Use the ‘v’ command to view the list of bookmarks you’ve saved.
Here’s a look at a couple of other prominent websites when opened in the Web browser.
Wall Street Journal
In addition to websites, you can also use Lynx to open files kept locally. For example, the following command opened a file named ‘test’ located on my desktop:
It’s worth mentioning that, by default, Lynx will only let you view local files. However, you can specify an editor in the Options Menu if you want to edit files on the go. To go to the Options Menu press ‘O,’ and once there, specify the editor name in the Editor field. For example, I specified ‘gedit.’
Once this setting is done you can launch the editor by pressing the ‘e’ key. After you’re done with the changes, exit the editor and return to the Web browser which will now display the updated file.
For more information on Lynx as well as the features/options it provides, head to the Web browser’s user guide available on its official website.
Despite being a command line-based Web browser, Lynx is neither difficult to use, nor difficult to understand. Of course, it can’t be regarded as a full-fledged Web browser, but that’s not its aim anyway. It’s worth knowing that Lynx can even be used to determine the way search engines and Web crawlers see a website, making it a handy tool for website designers as well.
Our latest tutorials delivered straight to your inbox