Call web pages in the terminal with Browsh

Block Graphics

Typist

The first launch takes a moment. Wait for Browsh to open its own website, and then press Ctrl+L to change focus to the address bar where you can type in the address of the website you want to visit. Press Enter to confirm. Alternatively, you can pass in the URL of the website directly when calling Browsh at the command line:

$ browsh --startup-url https://admin-magazine.com

If you want to exit automatically after a specified number of seconds, use the --time-limit parameter.

The browser operates as usual by clicking on the appropriate menu items and links with the mouse and navigating through the page with the arrow and scroll keys. If you expand or shrink the terminal window, Browsh automatically adjusts the page display. The display is updated in real time, which is why you can view videos and see animated GIFs.

Browsh recognizes the keyboard shortcuts known from conventional web browsers (Table 1). Pressing Alt+M switches to the monochrome display, which removes all graphics (Figure 3). In this case, the software only uses the foreground and background terminal colors and works with terminals that display only two colors.

Table 1

Fast Control

Key Function
F1 Documentation
Arrow keys, Page Up, Page Down Navigate the page
Ctrl+Q Exit Browsh
Ctrl+L Activate address bar (to enter URL)
Ctrl+R Reload/refresh page
Ctrl+T Open new tab
Ctrl+W Close current tab
Backslash Switch to next tab
Backspace Go back in history
Alt+M Switch to monochrome display
Alt+U Change user agent identification
Alt+Shift+P Create screenshot
Figure 3: Pressing Ctrl+M switches Browsh to a monochrome view, shown here with the Linux Magazine website.

You can force the program into monochrome mode by calling it with browsh --monochrome. Pressing Alt+U runs the browser as a smartphone version, which requests a page optimized for mobile devices and may be more suitable for displaying as text.

Character Mash

Browsh uses UTF-8 characters in output, so if you're having problems, you should make sure your terminal can handle this kind of character encoding. The font used by the terminal must support all UTF-8 characters – in particular, the half block, a box character Browsh uses to compose images. Some fonts draw this small box a little smaller, which makes the output look streaky.

The terminal should also use a fixed (non-proportional) font, otherwise the layout of a web page will become disjointed. Buckley-Houston recommends a number of fonts [2]. Last but not least, the terminal itself must align the characters correctly and exactly, otherwise confusing layouts will result.

Browser in Browser

When first launched, Browsh creates a config file named ~/.config/browsh/config.toml. If necessary, you can use a text editor to adjust the settings. Adding startup-url= points to the URL that the program calls by default.

If you type only one keyword in the address bar, Browsh appends it to the address entered in default_search_engine_base=. The browser then calls the entire URL. By default, this calls Google search.

If you switch to the view for mobile devices with Alt+U, Browsh pretends to be Firefox running under Android 7.0. You can change the identity with the mobile_user_agent= setting. You will want to leave all other settings at their default values.

Browsh offers a mode in which the software itself acts as a server:

browsh --http-server-mode

If you then use any other web browser to access localhost:4333 , Browsh is available there as a service. If necessary, you can replace localhost with the IP address or the name of the computer on which the browser is running in server mode. Default port 4333 can be changed by editing the port= variable in the configuration file.

To call up a page (e.g., the ADMIN magazine homepage), append its URL, as for the http.brow.sh service, with:

localhost:4333/http://admin-magazine.com

In server mode, Browsh does not offer the complete feature set of the command-line variant. Thus, the software does not update the display in real time, and you are not allowed to log on to web pages.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Application security testing with ZAP in a Docker container
    Pitting the OWASP Zed Attack Proxy against an insecure web app in a Docker container illustrates how you can tick a lot of security checkboxes.
  • Managing access credentials
    Most Internet services require password-protected individual accounts. A password manager can help you keep track of all your access credentials.
  • Linux alternatives to Windows software
    Free software alternatives to common commercial Windows programs often are little understood. We show which applications on the Linux desktop give an especially good account of themselves.
  • Guacamole: Remote Desktop

    HTML5 offers a range of new features, such as audio and video support, without needing plugins like Flash or Java. This opens up completely new options in terms of content delivery via the web – and for mobile access to applications on the LAN.

  • Remote access with ThinLinc 4.12
    The revival of terminal servers during the Covid-19 crisis depended on the IT administrator to enable home office workplaces, with the help of tools like ThinLinc, a Linux remote desktop server.
comments powered by Disqus