使用命令行浏览器在 Linux 终端上网浏览
终端 浏览器
![](/data/attachment/album/202011/22/212007f9s7aabmcj4aa9lo.jpg)


我猜你阅读这篇文章可能是用 Firefox 或基于 Chrome 的浏览器（如 [Brave](https://itsfoss.com/brave-web-browser/)），或者，也可能是 Chrome 浏览器或 [Chromium](https://itsfoss.com/install-chromium-ubuntu/)。


换句话说，你正在利用基于 GUI 的方式浏览网页。然而，在以前，人们使用终端来获取资源和浏览网页，因为所有的东西大多是基于文本的。


虽然现在不能从终端上获取每个信息，但对于一些文本信息，还是可以尝试使用命令行浏览器，从 Linux 终端上打开网页。


不仅如此，如果你访问的是远程服务器，或者只有一个没有 GUI 的终端，终端网页浏览器就可以发挥用处了。


因此，在本文中，我将介绍一些基于终端的 Web 浏览器，你可以在 Linux 上尝试它们。


### Linux 用户的最佳终端 Web 浏览器


注：此榜单排名不分先后。


#### 1、W3M


![](/data/attachment/album/202011/22/212553gpd6g2vzk20ve5sg.jpg)


`w3m` 是一个流行的基于文本的开源终端 Web 浏览器。尽管其初始项目已经不再活跃，但另一个开发者 Tatsuya Kinoshita 正在维护着它的一个活跃分支。


`w3m` 相当简单，支持 SSL 连接、色彩，也支持内嵌图片。当然，根据你试图访问的资源，你那边的情况可能会有所不同。根据我的简单测试，它似乎无法加载 [DuckDuckGo](https://duckduckgo.com/)，但我可以[在终端中使用 Google](https://itsfoss.com/review-googler-linux/)就够了。


安装后，你可以简单的在终端中输入 `w3m` 以得到帮助。如果你感兴趣的话，也可以到 [GitHub](https://github.com/tats/w3m) 上去查看它的仓库。


**如何安装和使用 w3m？**


`w3m` 在任何基于 Debian 的 Linux 发行版的默认仓库中都是可用的。如果你有一个基于 Arch 的发行版，但没有直接可用的软件包，你可能需要查看一下 [AUR](https://itsfoss.com/aur-arch-linux/)。


对于 Ubuntu，你可以通过键入以下内容来安装它：



```
sudo apt install w3m w3m-img

```

在这里，我们将 w3m 包和图片扩展一起安装，以支持内嵌图片。接下来，要开始安装，你只需要按照下面的命令进行操作即可：



```
w3m xyz.com

```

当然，你需要将 `xyz.com` 替换成任何你想浏览或测试的网站。最后，你应该知道，你可以使用键盘上的方向键来导航，当你想采取一个动作时，按回车键。


要退出，你可以按 `SHIFT+Q`，返回上一页是 `SHIFT+B`。其他快捷键包括用 `SHIFT+T` 打开新标签页和用 `SHIFT+U` 打开新的 URL。


你可以通过访问它的手册页来了解更多信息。


#### 2、Lynx


![](/data/attachment/album/202011/22/212611h22p4g4db7k7fbpf.jpg)


Lynx 是另一个开源的命令行浏览器，你可以试试。幸运的是，很多的网站在使用 Lynx 时往往能正常工作，所以我说它在这方面肯定更好。我能够加载 DuckDuckGo，并使其工作。


除此之外，我还注意到它可以让你在访问各种 Web 资源时接受或拒绝 cookie。你也可以将它设置为总是接受或拒绝。所以，这是件好事。


另一方面，在终端上使用时，窗口不能很好地调整大小。我还没有寻找到任何解决方法，所以如果你正在尝试这个，你可能会想要这样做。不论如何，它都很好用，当你在终端启动它时，你会得到所有键盘快捷键的说明。


请注意，它与系统终端主题不匹配，所以无论你的终端看起来如何，它都会看起来不同。


**如何安装 Lynx？**


与 w3m 不同的是，如果你有兴趣尝试的话，确实可以找到一些 Win32 上的安装程序。不过，在 Linux 上，它在大多数的默认仓库中都是可用的。


对于 Ubuntu 来说，你只需要输入：



```
sudo apt install lynx

```

要想使用，你只需要按照下面的命令进行操作：



```
lynx examplewebsite.com

```

在这里，你只需要将示例网站替换成你想要访问的资源即可。


如果你想找其他 Linux 发行版的软件包，可以查看他们的[官网资源](https://lynx.invisible-island.net/lynx-resources.html)。


#### 3、Links2


![](/data/attachment/album/202011/22/212634u21h4jihxhyzrh4x.jpg)


Links2 是一款有趣的基于文本的浏览器，你可以在你的终端上轻松使用，用户体验良好。它提供了一个很好的界面，你启动它后，只要输入网址就可以了。


![](/data/attachment/album/202011/22/212700lhq9qivfoiqiod8q.jpg)


值得注意的是，主题将取决于你的终端设置，我设置为“黑绿色”主题，因此你看到的就是这个。当你以命令行浏览器的方式启动它后，你只需要按任意键就会出现 URL 提示，或者按 `Q` 键退出。它相当好用，可以渲染大多数网站的文字。


与 Lynx 不同的是，你没有接受或拒绝 cookie 的功能。除此之外，它似乎工作的还不错。


**如何安装 Links2？**


正如你所期望的，你会发现它在大多数默认的仓库中都有。对于 Ubuntu，你可以在终端输入以下命令来安装它：



```
sudo apt install links2

```

如果你想在其他 Linux 发行版上安装它，你可以参考它的[官方网站](http://links.twibright.com/download.php)获取软件包或文档。


#### 4、eLinks


![](/data/attachment/album/202011/22/212735pxmbzpvx4980xxqq.jpg)


eLinks 类似于 Links2，但它已经不再维护了。你仍然可以在各种发行版的默认仓库中找到它，因此，我把它保留在这个列表中。


它不会与你的系统终端主题相融合。所以，如果你需要的话，作为一个没有“黑暗”模式的文本型浏览器，这可能不是一个漂亮的体验。


**如何安装 eLinks？**


在 Ubuntu 上，安装它很容易。你只需要在终端中输入以下内容：



```
sudo apt install elinks

```

对于其他 Linux 发行版，你应该可以在标准软件仓库中找到它。但是，如果你在软件仓库中找不到它，你可以参考[官方安装说明](http://elinks.or.cz/documentation/installation.html)。


### 总结


在终端上运行的基于文本的 Web 浏览器并不多，这并不奇怪。一些项目，如 [Browsh](https://www.brow.sh/)，试图呈现一个现代的 Linux 命令行浏览器，但在我这里它不能工作。


虽然像 `curl` 和 `wget` 这样的工具允许你[从 Linux 命令行下载文件](https://itsfoss.com/download-files-from-linux-terminal/)，但这些基于终端的 Web 浏览器提供了额外的功能。


除了命令行浏览器之外，如果你想在终端上玩玩，也可以尝试一些[Linux 命令行游戏](https://itsfoss.com/best-command-line-games-linux/)。


对于 Linux 终端上的文本型 Web 浏览器，你有什么看法？欢迎在下面的评论中告诉我你的想法。




---


via: <https://itsfoss.com/terminal-web-browsers/>


作者：[Ankush Das](https://itsfoss.com/author/ankush/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[wxy](https://github.com/wxy) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
![Warp Terminal](/assets/images/warp-terminal.webp)


![Warp Terminal](/assets/images/warp-terminal.webp)

I’m guessing that you are probably using Firefox or a Chrome-based browser like [Brave](https://itsfoss.com/brave-web-browser/) to read this article. Or, maybe, Google Chrome or [Chromium](https://itsfoss.com/install-chromium-ubuntu/) or other [web browsers available for Linux](https://itsfoss.com/best-browsers-ubuntu-linux/).

In other words, you are utilizing a GUI-based approach to browse the web. However, back in the days, people used the terminal to fetch resources and browse the web because everything was mostly text-based information.

Even though you cannot get every information from a terminal now, you can still try the command line browsers for some text-based information and open a web page from the Linux terminal.

Not just limited to that, but if you are accessing a remote server or stuck in a terminal without a GUI, a terminal web browser can prove to be useful as well.

So, in this article, I will be mentioning some terminal based web browsers that you can try on Linux.

**Note:** The list is in no particular order of ranking.

## 1. W3M

![W3m Google](https://itsfoss.com/content/images/wordpress/2020/10/w3m-google.jpg)

w3m is a popular open-source text-based web browser for the terminal. Even though the original project is no longer active, an active version of it is being maintained by a different developer Tatsuya Kinoshita.

w3m is quite simple, supports SSL connections, colors, and in-line images as well. Of course, depending on what resource you are trying to access, things might look different on your end. As per my quick test, it didn’t seem to load up [DuckDuckGo](https://duckduckgo.com/?ref=itsfoss.com) but I could [use Google in terminal](https://itsfoss.com/review-googler-linux/) just fine.

You can simply type **w3m** in the terminal to get help after installation. If you’re curious, you can also check out the repository at [GitHub](https://github.com/tats/w3m?ref=itsfoss.com).

### How to install and use w3m?

W3M is available on most of the default repositories for any Debian-based Linux distribution. If you have an Arch-based distro, you might want to check [AUR](https://itsfoss.com/aur-arch-linux/) if it’s not available directly.

For Ubuntu, you can install it by typing in:

`sudo apt install w3m w3m-img`


Here, we are installing the w3m package along with image extension for in-line image support. Next, to get started, you have to simply follow the command below:

`w3m xyz.com`


Of course, you need to replace xyz.com to any website that you want to browse/test. Finally, you should know that you can use the keyboard arrow keys to navigate and press enter when you want to take an action.

To quit, you can press **SHIFT+Q**, and to go back to the previous page — **SHIFT+B**. Additional shortcuts include **SHIFT + T** to open a new tab and **SHIFT + U** to open a new URL.

You can explore more about it by heading to its man page as well.

## 2. Lynx

![Lynx Terminal](https://itsfoss.com/content/images/wordpress/2020/10/lynx-terminal.jpg)

Lynx is yet another open source command line browser which you can try. Fortunately, more websites tend to work when using Lynx, so I’d say it is definitely better in that aspect. I was able to load up DuckDuckGo and make it work.

In addition to that, I also noticed that it lets you accept/deny cookies when visiting various web resources. You can set it to always accept or deny as well. So, that’s a good thing.

On the other hand, the window does not re-size well while using it from the terminal. I haven’t looked for any solutions to that, so if you’re trying this out, you might want to do that. In either case, it works great and you get all the instructions for the keyboard shortcuts right when you launch it in the terminal.

Note that it does not match the system terminal theme, so it will look different no matter how your terminal looks like.

### How to install Lynx?

Unlike w3m, you do get some Win32 installers if you’re interested to try. But, on Linux, it is available on the most of the default repositories.

For Ubuntu, you just need to type in:

`sudo apt install lynx`


To get started, you just have to follow the command below:

`lynx examplewebsite.com`


Here, you just need to replace the example website with the resource you want to visit.

If you want to explore the packages for other Linux distros, you can check out their [official website resources](https://lynx.invisible-island.net/lynx-resources.html?ref=itsfoss.com).

## 3. Links2

![Links2 Terminal](https://itsfoss.com/content/images/wordpress/2020/10/links2-terminal.jpg)

Links2 is an interesting text-based browser that you can easily utilize on your terminal with a good user experience. It gives you a nice interface to type in the URL and then proceed as soon as you launch it.

![Links2 Terminal Welcome](https://itsfoss.com/content/images/wordpress/2020/10/links2-terminal-welcome.jpg)

It is worth noting that the theme will depend on your terminal settings, I have it set as “black-green”, hence this is what you see. Once you launch it as a command line browser, you just need to press any key to bring the URL prompt or Q to quit it. It works good enough and renders text from most of the sites.

Unlike Lynx, you do not get the ability to accept/reject cookies. Other than that, it seems to work just fine.

### How to install Links2?

As you’d expect, you will find it available in the most of the default repositories. For Ubuntu, you can install it by typing the following command in the terminal:

`sudo apt install links2`


You can refer to its [official](http://links.twibright.com/download.php?ref=itsfoss.com)[ ](http://links.twibright.com/download.php?ref=itsfoss.com)[website](http://links.twibright.com/download.php?ref=itsfoss.com) for packages or documentations if you want to install it on any other Linux distribution.

## 4. eLinks

![Elinks Terminal](https://itsfoss.com/content/images/wordpress/2020/10/elinks-terminal.jpg)

eLinks is similar to Links2 — but it is no longer maintained. You will still find it in the default repositories of various distributions, hence, I kept it in this list.

It does not blend in with your system terminal theme. So, this may not be a pretty experience as a text-based browser without a “dark” mode if you needed that.

### How to install eLinks?

On Ubuntu, it is easy to install it. You just have to type in the following in the terminal:

`sudo apt install elinks`


For other Linux distributions, you should find it available on the standard repositories. But, you can refer to the [official installation instructions](http://elinks.or.cz/documentation/installation.html?ref=itsfoss.com) if you do not find it in the repository.

## More such terminal stuff

It’s no surprise that there aren’t a lot of text-based web browsers to run on the terminal. Some projects like [Browsh](https://www.brow.sh/?ref=itsfoss.com) have tried to present a modern Linux command-line browser but it did not work in my case.

While tools like curl and wget allow you to [download files from the Linux command line](https://itsfoss.com/download-files-from-linux-terminal/), these terminal-based web browsers provide additional features.

[How to Download Files From Terminal in Ubuntu & Other LinuxIf you are stuck to the Linux terminal, say on a server, how do you download a file from the terminal? Here are some commands to download files and webpages.](https://itsfoss.com/download-files-from-linux-terminal/)![](https://itsfoss.com/content/images/wordpress/2020/10/Download-Files-from-Linux-terminal.png)


![](https://itsfoss.com/content/images/wordpress/2020/10/Download-Files-from-Linux-terminal.png)

In addition to command-line browsers, you may also like to try some [command line games for Linux](https://itsfoss.com/best-command-line-games-linux/), if you want to play around in the terminal.

[Top 10 Command Line Games For LinuxYou can play games on the Linux terminal. Here are the best command line games for you.](https://itsfoss.com/best-command-line-games-linux/)![](https://itsfoss.com/content/images/2023/01/best-command-line-games-for-linux.png)


![](https://itsfoss.com/content/images/2023/01/best-command-line-games-for-linux.png)

Browsing web in the Linux terminal or [using the Linux terminal in a web browser](https://itsfoss.com/online-linux-terminals/), you can do it all.

What do you think about the text-based web browsers for Linux terminal? Feel free to let me know your thoughts in the comments below.