Запустить браузер через терминал линукс

is there a way to open browser using terminal? [duplicate]

Is there a way to open Chrome (or other browser) using terminal? Something like: $ chrome www.google.com ?

3 Answers 3

If you want to open Chrome to a specific URL, just run

google-chrome www.example.com 

To open your default browser to a specific URL, run

If you need to run Chrome and close the terminal window afterward, run

google-chrome http://www.google.com /dev/null 2>&1 & disown 

>/dev/null 2>&1 will prevent messages from the browser to be outputted to the terminal’s window; & will put the process into the background and disown will remove the job / process from the job list, preventing a SIGHUP signal to be propagated to it.

To do this with another browser simply replace google-chrome with that other browser’s executable name.

Thanks! But there is a slight difference comparing to using a launcher. I will kill the process if I close terminal or ctrl+c. It’s not a big deal though.

Sure, but use google-chrome http://www.google.com /dev/null 2>&1 & disown , because stdout and stderr get printed to the terminal without the redirections

Almost: >/dev/null 2>&1 prevents stdout and stderr to be printed to the terminal,

sensible-browser seems to be the option you’re looking for. This will run the web browser set as default on your system, you can also pass parameters on it in order to run the web browser and open the given website(s).

Usage:

In a terminal, drop the next and hit Return

Passing parameters:

The next command will open youtube.com in your preferred web browser:

sensible-browser youtube.com 

How to set my favorite web browser flavour from the terminal?

Simply drop the next command in a terminal, hit Return and choose wisely:

sudo update-alternatives --config x-www-browser 

In the next example I am choosing luakit as my default browser. You can change your default web browser as many times as you wish.

geppettvs@T400:~$ sudo update-alternatives --config x-www-browser There are 5 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/google-chrome-stable 200 auto mode 1 /usr/bin/firefox 40 manual mode 2 /usr/bin/google-chrome-stable 200 manual mode 3 /usr/bin/konqueror 30 manual mode 4 /usr/bin/luakit 10 manual mode 5 /usr/bin/xlinks2 69 manual mode Press enter to keep the current choice[*], or type selection number: 4 update-alternatives: using /usr/bin/luakit to provide /usr/bin/x-www-browser (x-www-browser) in manual mode 

Unattaching from terminal

If you wish to keep your web browser running just after you close your terminal, simply add an ampersand symbol at the end of your command:

sensible-browser [parameters] & 

Источник

Читайте также:  Wifi drivers for linux

Есть ли способ открыть браузер с помощью терминала?

Есть ли способ открыть Chrome (или другой браузер) с помощью терминала?

Что-то вроде: $ chrome www.google.com ?

3 ответа

Если вы хотите открыть Chrome по определенному URL, просто запустите

google-chrome www.example.com 

Чтобы открыть браузер по умолчанию для определенного URL, запустите

Если вам нужно запустить Chrome и потом закрыть окно терминала, запустите

google-chrome http://www.google.com /dev/null 2>&1 & disown 

>/dev/null 2>&1 запретит вывод сообщений из браузера в окно терминала; & поставит процесс на задний план и disown удалит задание / процесс из списка заданий, предотвращая распространение на него сигнала SIGHUP.

Для этого с другим браузером просто замените google-chrome с исполняемым именем этого другого браузера.

Вы можете удивительно открыть Google Chrome из терминала, запустив

Вы также можете запустить Firefox, запустив

И вы можете добавить URL в качестве параметра, чтобы открыть его тоже.

sensible-browser кажется, вариант, который вы ищете. Это запустит веб-браузер, установленный по умолчанию в вашей системе, вы также можете передать в него параметры, чтобы запустить веб-браузер и открыть указанные веб-сайты.

Использование:

В терминале бросьте следующий и нажмите Return

Передача параметров:

Следующая команда откроет http://youtube.com/ в вашем любимом веб-браузере:

sensible-browser youtube.com 

Как установить мой любимый вид браузера в терминале?

Просто поместите следующую команду в терминал, нажмите Return и выберите мудро:

sudo update-alternatives --config x-www-browser 

В следующем примере я выбираю luakit как мой браузер по умолчанию. Вы можете изменить веб-браузер по умолчанию столько раз, сколько пожелаете.

[email protected]:~$ sudo update-alternatives --config x-www-browser There are 5 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/google-chrome-stable 200 auto mode 1 /usr/bin/firefox 40 manual mode 2 /usr/bin/google-chrome-stable 200 manual mode 3 /usr/bin/konqueror 30 manual mode 4 /usr/bin/luakit 10 manual mode 5 /usr/bin/xlinks2 69 manual mode Press enter to keep the current choice[*], or type selection number: 4 update-alternatives: using /usr/bin/luakit to provide /usr/bin/x-www-browser (x-www-browser) in manual mode 

Отсоединение от терминала

Если вы хотите, чтобы ваш веб-браузер работал сразу после закрытия терминала, просто добавьте символ амперсанда в конце команды:

sensible-browser [parameters] & 

Источник

How to open Google Chrome from the Terminal in Ubuntu?

Although most versions of Ubuntu come with Mozilla Firefox installed as the default browser, having Google Chrome installed has its fair advantages. Google Chrome has been the superior choice when it comes to browsing on a desktop, having support for most plugins and a variety of add-ons, the likes of which cannot be found on any other browser.

Читайте также:  Перезапустить виртуальную машину linux

This makes Google Chrome an ideal browser and a must-have no matter which operating system you are running. This guide will help you install Google Chrome on Ubuntu and instructions to use it with the help of the Terminal.

Although this guide is meant for versions of Ubuntu, it should work the same way for any Linux Distribution.

Installing Google Chrome on Ubuntu

There are two methods to install Google Chrome on Ubuntu. One is using the Graphical User Interface (GUI) and the other by using the Linux Terminal. We will first explain the graphical method and briefly examine how to do it from the Command Line Interface (CLI), i.e., the Terminal.

Open Mozilla Firefox and type “Google Chrome” in the search bar or click here.

You should see a chrome window with a “Download Chrome” button, as shown in the image below. Click on the button to download the browser.

You will be given the option to download .deb or .rpm, which has to do with what Linux Distro you are using. Since this article is concerned with Ubuntu, click on the .deb package and press “Accept and Install.”

A download window should appear. Click on Save File and press OK.

Having done that, double-clicking the file, you downloaded should do. A new window will appear that will prompt you to install Google Chrome on your device. Click on “Install”.

Ubuntu will ask you to authorize the installation by entering your account password.

Alternatively, you can also install Chrome through the Terminal. To do this, we must first use a wget command.

This will download the offline installer for the browser.

Next, we install the package with the following dpkg command.

If you get any errors about missing dependencies, run the following command to forcibly install them.

Having successfully installed the Debian package, you are now ready to use Google Chrome.

Opening Google Chrome using the Terminal

Google Chrome, like any other program, can be accessed through its graphical icon. However, those that are fond of using the command-line Terminal to do things are also in luck. We will now show you a way to operate the Chrome browser through the Terminal.

Working on the Terminal allows you to access the browser using a single command. To open Google Chrome with the help of the command line, follow the steps given below:

Go to Desktop > Applications.

Type Terminal in the search bar and click on the first result.

Читайте также:  Ftp server astra linux

Or you can skip the lengthy process and open a new Terminal session by pressing Ctrl + Alt + T on your keyboard.

To open Google Chrome, type the following in the Terminal:

This will load up Google Chrome with the default homepage.

Google Chrome does not require you to specify any sort of directories as it is mounted in the binary path.

Let’s look at some more ways to use the Google Chrome browser through the Terminal. Let’s say, for instance, that you wish to visit a specific website. You can do this by entering the URL of the website of your choice, as shown in the command below:

Similar to other Terminal commands, you can enter flags and command parameters with the Google Chrome run command to achieve specific tasks. The general syntax of performing this is given below.

Below is a list of flag options that you can use to achieve daily life tasks through the Terminal.

—incognito Opens the browser in incognito mode
—new-window Opens the path or URL specified in a new window
—version Displays the Version Information
—app=URL Used to run URL in app mode, meaning without toolbars.

If you wish to explore your options even further, run the help command given below:

Additional comments

Keep in mind that to run Google Chrome on your Linux system, the computer architecture must be 64-bit.

Once you install Google Chrome the way we showed you in this guide, you also add Google’s repository, which is responsible for keeping the program up-to-date. So, you do not need to worry about updating the browser yourself.

You can find the path where Google Chrome is located by typing the following command:

You should see the path specified as shown in the image below:

You can also close the browser with the help of the Terminal by typing the following command:

Conclusion

With all the steps followed correctly, you are now ready to use Google Chrome on your laptop or desktop computer. Enjoy one of the fastest and most versatile browsers available to you in the present day and age.

We hope this guide helped you understand how to access Google Chrome with the help of Terminal commands. Apart from that, we also included additional information on how to maneuver through the options and URL shortcuts that come with them.

About the author

Zeeman Memon

Hi there! I’m a Software Engineer who loves to write about tech. You can reach out to me on LinkedIn.

Источник

Оцените статью
Adblock
detector