Is it possible to access “linuxtldr.com” or any other website from the Linux terminal? Yes, and you will also learn how to do it in this article.
|Description||Accessing Webpages using W3M Command-Line Utility|
|Root or Sudo Privileges||No|
|Host System and Architecture||Ubuntu 22.10 (x64)|
|OS Compatibility||Ubuntu, Manjaro, Fedora, etc.|
|Discussed Tools in this Article||–|
What is the W3M in Linux?
The W3M is an open-source Linux utility that allows you to browse web pages in a text-based format from your Linux terminal.
Alternatively, you can use another tool, named Lynx, to browse the internet from the Linux terminal, which is also recommended by the Linux community.
However, there are a few differences between them, as mentioned below.
- W3M supports inline images and tables while Lynx does not.
- Lynx has a more basic interface than W3M.
- W3M has advanced features like mouse support and tabbed browsing.
Concluding that, let’s move on to the installation part of the W3M.
How to Install W3M on Linux
This command-line utility is not included by default in any Linux distribution. However, it can be easily installed from your default package manager if you have access to the internet.
Follow the following steps to install it based on your Linux distribution.
Debian, Ubuntu, or Pop!_OS
Open your Linux terminal and execute the following command to install it from your APT package manager:
$ sudo apt install w3m
Red Hat, Fedora, or AlmaLinux
On this distribution, you use the DNF package manager to install it on your system.
$ sudo dnf install w3m
Arch, Manjaro, or EndeavourOS
Arch users can use the Pacman package manager to install it on their system.
$ sudo pacman -S w3m
Once the installation process is complete, please refer to the next section for usage instructions.
Instructions for Use
As I mentioned at the beginning of this article, it’s a text-based browser that works slightly differently than a standard browser. So, make sure to note the following key mapping:
|Arrows Keys||Used to move the pointer around the desired links.|
|Tab Key||Used to jump from link to link.|
|Load the desired link once you select it or hover over it by pressing the enter key.|
|Shift+T||Open a new browser tab.|
|Ctrl+H||Display your browsing history.|
|“q” Then (“Y” = yes) or (“N” = no)||To quit.|
Check out this link to learn more. With that, let’s move on to the use of this tool.
How to use the W3M in Linux
There are multiple ways to use this tool, like browsing the internet or translating your written HTML. We will cover most of the examples, starting with the most basic, browsing the internet.
Visiting Websites with W3M in a Text Mode
The default viewing mode for W3M without any options is text-mode; all you have to do is specify the command and type your desired URL, as shown.
$ w3m linuxtldr.com
Quite amusing, right? As you can see from the above picture, graphic elements and many more will not be rendered. So, for now, you can use this tool for most of your reading, like articles and blogs.
Visiting Websites with W3M in a Monochrome Display Mode
In the previous text mode, you had to use the arrow keys or tab key to move around the links, which was sluggish. However, you can specify the “
-M” flag as an argument to this command to launch the W3M in monochrome display mode.
The output will still be text-based, but all text will be stylized in monochromatic color, and you can use the mouse to click on or navigate to the links.
$ w3m -M linuxtldr.com
Use W3M as a Pager
You can pipe the W3M with another command to act as a pager and give all the capabilities that you have while browsing.
For example, I have a “file.txt” file in my home directory, and I will read its content using the cat command and pipe them to the W3M, as shown.
$ cat file.txt | w3m
Translate HTML Files
Like the previous example, if you have an HTML file on your system, you can translate the HTML file content using the W3M command. But as you know, it is a text-based tool, so it cannot render the graphic material of the HTML file like CSS.
$ cat index.html | w3m -T text/html
There is a lot more you can do with this tool. However, if you don’t like it as much, you can remove it from your system by following the next section.
How to Remove W3M from Linux
Simply execute one of the following commands based on your Linux distribution:
$ sudo apt remove w3m #Debian, Ubuntu, or Pop!_OS $ sudo dnf remove w3m #Red Hat, Fedora, or AlmaLinux $ sudo pacman -R w3m #Arch, Manjaro, or EndeavourOS
So, here comes the end of this article.
It is quite interesting, and I’ve used it for a very long time. You will not face any issues except being kept away from the visual element of the site.
However, if you have any questions or queries related to this article, then feel free to ask them in the comment section.
Till then, peace!
Join The Conversation
Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.