Is there a command I can use in Bash that will open a specific URL in the default browser?
Ubuntu – Command to open a URL
command line
Related Question
- Ubuntu – How to open file with default application from command line
- Ubuntu – How to open a directory/folder and a URL through Terminal
- Ubuntu – How to open an URL from command line to Firefox and “switch to tab”
- Ubuntu – Terminal command to open URL’s in default and non-default browser
- Ubuntu – Open URL in default browser (Chromium) from terminal and give browser focus
- Ubuntu – How to open a specific application like macOS `open -a`
Best Answer
There's a command that knows about your default browser:
This will also work for every other type of URI (Uniform Resource Identifier), like images - which will automatically open with eog, openoffice documents, and so on, and also on filesystem paths (
xdg-open /tmp/foobar.png
).There is also
and
To find out what application is going to be used.
You can set your preffered application by going to System → Preferences → Preferred Applications:
These utilities are part of the freedesktop.org specification, so you can use them in your applications - and it's going to work on all of the desktops that adhere to the spec.