- How to open default browser from command line Linux
- Checking default web browser:
- Opening default web browser from the command line:
- Changing default web browser:
- Conclusion:
- About the author
- Talha Saif Malik
- How to Open a URL in the Web Browser from Linux Terminal
- 1. The xdg-open Command
- 2. The sensible-browser Command
- 3. The x-www-browser Command
- 4. Alternative Commands to Open URL
- How to browse the internet using Debian Terminal
- 1. The Links Web Browser
- 2. W3m Web Browser
- 3. Lynx Web Browser
- 4. ELinks Web Browser
- Search
- About This Site
- Latest Tutorials
How to open default browser from command line Linux
On Ubuntu, you might have several web browsers installed, which are utilized according to your browsing preferences. Although, we all have a most favorite web browser to use 90% of the internet every day. In Linux, it is preferred to state the best browser as the default browser. This default browser will also allow you to open links from the terminal.
Checking default web browser:
To set, change or view the default browser through a terminal or user interface is simple yet straightforward.
Write out the below-given command to know the default browser of your Linux system.
You can look into the list of other default applications, including your default browser. For performing this, there are two methods, In the first method, you can use the below-given command, and it will redirect you to the Default Application windows.
Searching “Default Applications” in the activities is considered as the second method.
The highlighted web browser in the “Web” option is already picked as the default web browser.
You can also check out the list of other available alternatives for browsing the web on your system.
The output declares that “Google Chrome” also exists as a web browser on our Ubuntu.
Opening default web browser from the command line:
Now, we will try to open the google instance in the default web browser, which is “firefox” in our case. Utilize the below-given command in your terminal if you want to do so.
Here, you can see terminal command execution successfully open a google instance in our default web browser.
Changing default web browser:
For setting any other browser as the default one, you have to execute the “xdg” settings command with the browser name at the end. We will set “Google Chrome” as the default browser on our Linux system in the following example.
Again, open any web instance by specifying its URL in the “xdg” open command. Furthermore, we have chosen “Google” for the testing.
The output states that we are successful in setting “Google Chrome” as your default browser.
Conclusion:
As Linux users, we all have various installed web browsers, which we use according to our web preferences. Still, there exists a possibility of 90% using a single web browser for browsing activities which turns to be our default web browser. In this article, we have seen opening the default browser for any web instance from the command line. Furthermore, the procedure of viewing and setting any other alternatives to your default browser is also provided.
About the author
Talha Saif Malik
Talha is a contributor at Linux Hint with a vision to bring value and do useful things for the world. He loves to read, write and speak about Linux, Data, Computers and Technology.
How to Open a URL in the Web Browser from Linux Terminal
Flexibility is an underrated attribute overlooked by many users of the Linux operating system. Being a flexible Linux user implies that you can launch most; if not all, of your user and system applications from the command line interface without having to navigate and search for them from the system GUI applications’ menu.
Also, the flexibility of your Linux OS user experience not only applies to system-based applications like installed apps but also to non-system-based applications like web apps that require a URL for access.
When working with Linux, you don’t necessarily need to open a browser application before you can access targeted URLs associated with specific websites.
This article will walk us through various ways (commands) of opening a URL on a default browser application from the terminal.
1. The xdg-open Command
As per the Linux man page, the xdg-open command opens a file or URL via the user’s preferred/default file application or browser application.
Its usage can be demonstrated via the following command syntax:
For instance, to open the LinuxShellTips home page from the Linux command-line interface, we will execute the following command.
$ xdg-open 'http://ubuntumint.com'
The execution of the xdg-open command will open the specified URL on your default web browser application.
2. The sensible-browser Command
As per the Linux operating system man pages, the sensible-browser command can be used to execute sensible decisions regarding a default web browser application that can be used to open a targeted web URL.
Its implementation can be referenced from the following command syntax:
$ sensible-browser URL_OF_TARGETED_WEB_PAGE
For instance, we can access a random LinuxShellTips website URL in the following manner:
$ sensible-browser 'http://ubuntumint.com/ssh-passwordless-login-almalinux'
The execution of the sensible-browser command should redirect us to the specified URL on the default web browser.
The use of the sensible-browser command is fully supported in Debian-based Linux operating system distributions like Linux Mint and Ubuntu.
3. The x-www-browser Command
Even though the x-www-browser command might not exist in the Linux man-pages ($ man x-www-browser) of the Linux operating system distribution you are using, it is equally effective in redirecting a user to a specified web URL on their default web browser.
Its command syntax can be represented in the following manner:
$ x-www-browser URL_OF_TARGETED_WEB_PAGE
For demonstration, let us try to access another random web page on the LinuxShellTips website.
$ x-www-browser 'http://ubuntumint.com/download-files-remote-linux-servers'
The execution of the x-www-browser command should swiftly redirect you to a web browser with a display of the specified web page URL.
4. Alternative Commands to Open URL
You could alternatively use your browser name as part of the Linux command for opening the web page URL you are targeting:
For Firefox web browser:
For Google Chrome web browser:
$ google-chrome http://google.com
Despite the error messages on the terminal on executing these alternative commands, your specified web URL should open without any issues.
You now know some cool tweaks on opening web URLs on the Linux command-line without directly going to the web browser’s GUI app.
How to browse the internet using Debian Terminal
Today, we are going to talk about text-based web browsers. But you might be wondering that what’s the need for a text-based browser in today’s graphical age. There might be several reasons for it. one reason might be because some people are more Terminal savvy and they want to perform everything from their command line. Another reason might be the slow internet connection and annoying advertisements of GUI browser. So text-based browsers are the best tool that can help them enjoy a faster browser experience without any distractions.
In this article, we will discuss some of the ways to install and use text-based browsers in the Terminal.
We have run the commands and procedures mentioned in this article on a Debian based OS.
1. The Links Web Browser
Links is an open-source text-based web browser for Linux OS which you can sue in your Terminal. To install it, run the following command in Terminal:
$ sudo apt-get install links
Press y when the system prompts for confirmation and then wait for a while until the installation of Links is completed.
After installing Links, use the following command syntax to browse any webpage:
For instance, to browse Google website, enter the following command in Terminal:
Some useful keyboard shortcuts for Links browser:
To open a new tab: Shift+T
To navigate: Up and Down arrow keys
To open the link: Right arrow key
To go back one page: Left arrow key
To quit the program: Q
2. W3m Web Browser
W3m is another open-source text-based web browser for Linux. To install it, run the following command in the Terminal. W3m in the below command is for the main package while w3m-img package is for inline image support.
$ sudo apt-get install w3m w3m-img
Press y when the system prompts for confirmation and then wait for a while until the installation of W3m is completed.
After installing W3m, use the following command syntax to browse any webpage:
For instance, to browse Google website, enter the following command in Terminal:
To type anything, select the text input area with cursor and press Enter before typing the text.
Some useful keyboard shortcuts for W3m web browser :
To open a new tab: Shift+T
To navigate: Arrow keys
To open a link: Enter
To load a new URL: Shift+U
To go back one page: Shift+B
To quit the program: Shift+Q
3. Lynx Web Browser
Lynx Browser is also a terminal-based Web Browser used to access websites on a Linux Terminal. Similar to other web browsers, Lynx Web Browser comes with some useful options and supports protocols like HTTP, FTP, HTTPS, etc. It is one of the oldest browsers still in use.
To install Lynx browser, run the following command in Terminal:
Press y when the system prompts for confirmation and then wait for a while until the installation of Lynx is completed.
After installing Lynx, use the following command syntax to browse any webpage:
For instance, to browse Google website, enter the following command in Terminal:
Some useful keyboard shortcuts for Lynx browser:
To navigate: Up and Down arrow keys
To load a link: Right arrow key
To go back one page: Left arrow key
To quit the program: Q
4. ELinks Web Browser
Elinks is a full-featured, advanced, and highly customizable terminal-based web browser. To install Elinks, run the following command in Terminal:
$ sudo apt-get install elinks
Press y when the system prompts for confirmation and then wait for a while until the installation of ELinks is completed.
After installing ELinks, use the following command syntax to browse any webpage:
For instance, to browse Google website, enter the following command in Terminal:
Some useful keyboard shortcuts for ELinks browser:
To open a new tab: T
To navigate: Up and Down arrow keys
To select links: Enter
To load a new URL: G
To go back one page: left arrow
To quit the program: Q
So these were some ways you can use in order to browse internet from the Debian Terminal without having the graphical interface. Now you can enjoy text-based and ad-free browsers at blazing speed.
Search
About This Site
Vitux.com aims to become a Linux compendium with lots of unique and up to date tutorials.