Mozilla Firefox, by its very virtue of being a web browser, is a program with a GUI front end. But make no mistake, the program can be launched from the command line, and there are quite a few handy options we can specify with this command.
In this guide, we’ll show how to open Firefox from the command line on a Linux system. We’ll also go over some tips and tricks so you can get the most out of launching Firefox via terminal.
In this tutorial you will learn:
- Linux commands for Firefox
Category | Requirements, Conventions or Software Version Used |
---|---|
System | Any Linux distro |
Software | Mozilla Firefox |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
Linux commands for Firefox
Let’s start with the most obvious and simple one. You can launch the Firefox browser by simply typing firefox
into a terminal.
$ firefox
You can also make Firefox go straight to a certain URL when it opens up, either in a new tab or in a new window. For example:
$ firefox https://linuxconfig.org OR $ firefox -new-tab https://linuxconfig.org OR $ firefox -new-window https://linuxconfig.org
If you want to open multiple websites, with each one being in their own tab, it’s best to use the -url
option.
$ firefox -url https://linuxconfig.org https://google.com
If you’d like to perform a search when Firefox opens, specify the -search
option.
$ firefox -search "linux tutorials"
You can also start Firefox in private mode.
$ firefox -private
Or, if you just want a private window but don’t want permanent private browsing mode (optionally, you can also specify a URL here):
$ firefox -private-window https://linuxconfig.org
The --kiosk
option is an interesting one. It allows you to open a URL without any of the Firefox user interface being present. It’s like a permanent full screen mode and may come in handy on a display PC where you don’t want users leaving Firefox. If you have trouble closing the window, remember you can use ALT + F4
on your keyboard.
$ firefox --kiosk https://linuxconfig.org
If you’re having trouble with Firefox, you can try launching it in safe mode to forego the loading any extensions or customized settings. This will help you figure out what’s causing an issue with Firefox.
$ firefox -safe-mode
Firefox stores personal information such as bookmarks, passwords, and user preferences as “profiles.” This is what allows multiple users to personalize their experience on a shared browser. Or you may have a unique case where you wish to use multiple profiles for one user.
Whatever the situation may be, you can use Firefox’s Profile Manager to create, delete, or rename profiles.
$ firefox -ProfileManager
To launch Firefox under a specific profile, you can use the -P
option while specifying the name of the profile. For example, this command would open Firefox with the linuxconfig
profile loaded:
$ firefox -P "linuxconfig"
Closing Thoughts
The Linux command line will always come in handy, even with GUI programs like a web browser. Firefox has given us a lot of command line options, some for troubleshooting and some for convenience. In this guide, we saw a few of the most useful commands, but there are even more available. You can get a full list in Mozilla’s documentation.