A text-mode browser is a type of web browser that displays only the text of websites without the graphic content. The web pages load faster and consume less bandwidth with text-only browsers.
Elinks is a popular text-mode browser in Linux. It supports colors, table rendering, background downloading, menu-driven configuration interface, tabbed browsing, and slim code.
You can use Elinks to browse through both local files and remote URLs. The main supported remote URL protocols are HTTP, HTTPS, and FTP.
How to install elinks
elinks is not installed by default in Linux. You can use the system package manager tool to get elinks.
Install elinks on CentOS, RHEL, Fedora
$ sudo dnf install elinks
Install elinks on Ubuntu and Debian
$ sudo apt install elinks
Syntax to use elinks command
The syntax for elinks
command is as follows:
$ elinks [option] URL
If elinks
is used without any arguments, it will prompt you to enter the URL.
Different examples to use elinks command
1. Open the local file
You can use the elinks command followed by the local HTML file to view the website.
$ elinks index.html
Sample Output:
To exit the browser interface, press q
and select Yes
.
2. Open remote URLs
Similarly, you can visit a remote website by specifying its URL. For example, to go to www.golinuxcloud.com, you can use the following command.
$ elinks www.golinuxcloud.com
Sample Output:
As you can see, it only displays the website in text format.
You can use up
and down
arrow keys for navigation and press enter
or right
arrow key to open a hyperlink. The left
arrow key takes you back to the previous page.
The left
mouse button also opens a hyperlink. For more options, click right
mouse button on the hyperlink.
To visit another website, you can press the g
key. It will prompt you to enter the URL.
3. Browse local files and folders
You can start elinks to open a local folder and browse files and folders in the system.
$ elinks local_folder
Sample Output:
Here, we are opening the directory /home/golinux
.
4. Run on an anonymous account
The -anonymous
option allows you to run the browser in an anonymous mode. Some features like local file browsing, downloads, and modification of options are not allowed with this option.
$ elinks -anonymous url
5. Automatically submit the form to the URLs
You can use the -auto-submit
option to submit the first form available in the given URLs.
$ elinks -auto-submit url
6. Print a configuration file
This option prints the elinks configuration file with built-in default options to stdout.
$ elinks -config-dump
Sample Output:
7. Print help for configuration options
To get additional information about configuration options, you can use config-help
.
$ elinks -config-help
Sample Output:
8. Print plain-text versions of URLs to stdout
The -dump
option is used to print a formatted plain-text version of URLs to stdout.
$ elinks -dump url
Sample Output:
9. Look up the specified host
The -lookup
option displays all DNS-resolved IP addresses of a given host.
$ elinks -dump url
Sample Output:
10. Display the source form of URL
The -source
option prints the source code of the URL.
$ elinks -source url
Sample Output:
To save the output in a file, you can use this command.
$ elinks -source www.ubuntu.com > file.html
Conclusion
elinks
is a great command-line tool for browsing websites in text mode. It is easy to use and provides features like table and frame rendering, color support, menu options, background downloads, FTP support, etc.
We hope this article helps you to understand how to use the elinks command in Linux. Feel free to ask any questions in the comment section.
What's Next
15+ wget command examples in Linux [Cheat Sheet]
15+ ping command examples in Linux [Cheat Sheet]
Further Reading