LinuxCommandLibrary

sensible-browser

Open a URL in the user's preferred browser

TLDR

Open a new window of the default browser

$ sensible-browser
copy

Open a URL in the default browser
$ sensible-browser [url]
copy

SYNOPSIS

sensible-browser [OPTIONS] URL...

PARAMETERS

URL...
    One or more Uniform Resource Locators (URLs) to open in the web browser. These are mandatory arguments.

[OPTIONS]
    Optional arguments that are passed directly to the chosen web browser. sensible-browser itself does not interpret these options; their behavior depends on the specific browser launched.

DESCRIPTION

sensible-browser is a utility that opens specified URLs using the system's preferred graphical web browser. It acts as a wrapper, abstracting away the specifics of which browser is installed or configured. The command attempts to determine the most appropriate browser to launch, prioritizing the BROWSER environment variable if set. If BROWSER contains a colon-separated list, sensible-browser tries each browser in sequence until one successfully opens. In modern Linux distributions, it often relies on xdg-open for determining the default application, providing a robust mechanism for launching URLs. This ensures a consistent user experience across different desktop environments and configurations, allowing users to simply open a URL without needing to know the exact browser command.

CAVEATS

The behavior of sensible-browser is heavily dependent on the system's configuration and the BROWSER environment variable. If no suitable browser is found or configured according to system defaults or the BROWSER variable, the command might fail or open a very basic text-based browser if available as a fallback. sensible-browser does not provide options for configuring the browser itself; it only launches it with the given URLs and passthrough options.

ENVIRONMENT VARIABLES

The BROWSER environment variable plays a crucial role in determining which browser sensible-browser will use. If set, it overrides system defaults. This variable can contain a single browser executable (e.g., firefox) or a colon-separated list of browser commands, which are tried in order of appearance until one successfully launches (e.g., export BROWSER=chromium:firefox:lynx).

HISTORY

sensible-browser is part of the sensible-utils package, primarily found in Debian-based Linux distributions. This set of utilities aims to provide a common, 'sensible' interface for performing common tasks (like opening a browser, editor, or pager) without requiring the user to know the exact command for their preferred application. Its development has focused on robust fallback mechanisms and integration with desktop environment standards, such as those provided by xdg-utils, to ensure wide compatibility and ease of use.

SEE ALSO

xdg-open(1), sensible-editor(1), sensible-pager(1)

Copied to clipboard