- How to Start Firefox from the Command Line in Linux
- Start Firefox to Open a Given URL
- Start Firefox to Open URL in A New Tab
- Open Firefox Browser Options
- Firefox Command Line Options
- Conclusion
- Command line options
- Syntax rules
- Using command line options
- Examples
- Windows
- macOS
- Linux
- User profile
- -allow-downgrade
- -CreateProfile profile_name
- -CreateProfile «profile_name profile_dir»
- -migration
- -new-instance
- -no-remote
- -override /path/to/override.ini
- -ProfileManager
- -P «profile_name»
- -profile «profile_path»
- Browser
- -browser
- -foreground
- -headless
- -new-tab URL
- -new-window URL
- —kiosk URL
- -preferences
- -private
- -private-window
- -private-window URL
- -search term
- -setDefaultBrowser
- -url URL
- Other components
- -devtools
- -inspector URL
- -jsdebugger
- -jsconsole
- -purgecaches
- -start-debugger-server PORT
- -venkman
- Linux-specific options
How to Start Firefox from the Command Line in Linux
If you want to start your Firefox Browser in your Linux system, and you can type one of the following commands:
Start Firefox to Open a Given URL
If you want to start Firefox browser to open a given URL (such as: www.osetc.com/en) from the command line, and you can issue the following command:
$ firefox --new-window https://osetc.com/en/
Just see the below screenshot:
Start Firefox to Open URL in A New Tab
If you want to start Firefox browser to open a URL in a new tab in your browser, and you can use “—new-tab” option, type:
$ firefox –new-tab https://osetc.com/en
Open Firefox Browser Options
If you want to open Firefox browser options, and you can use “—preferences” option, type:
Firefox Command Line Options
If you want to get all command line options for firefox command, just type the following command:
devops@devops:~$ firefox --help Usage: firefox [ options . ] [URL] where options include: X11 options --display=DISPLAY X display to use --sync Make X calls synchronous --g-fatal-warnings Make all warnings fatal Firefox options -h or --help Print this message. -v or --version Print Firefox version. -P Start with . --profile Start with profile at . --migration Start with migration wizard. --ProfileManager Start with ProfileManager. --no-remote Do not accept or send remote commands; implies --new-instance. --new-instance Open new instance, not a new window in running instance. --UILocale Start with resources as UI Locale. --safe-mode Disables extensions and themes for this session. --allow-downgrade Allows downgrading a profile. --MOZ_LOG= Treated as MOZ_LOG= environment variable, overrides it. --MOZ_LOG_FILE= Treated as MOZ_LOG_FILE= environment variable, overrides it. If MOZ_LOG_FILE is not specified as an argument or as an environment variable, logging will be written to stdout. --headless Run without a GUI. --save-recordings Save recordings for all content processes to a directory. --browser Open a browser window. --new-window Open in a new window. --new-tab Open in a new tab. --private-window Open in a new private window. --preferences Open Preferences dialog. --screenshot [] Save screenshot to or in working directory. --window-size width[,height] Width and optionally height of screenshot. --search Search with your default search engine. --setDefaultBrowser Set this app as the default browser. --jsconsole Open the Browser Console. --jsdebugger Open the Browser Toolbox. --wait-for-jsdebugger Spin event loop until JS debugger connects. Enables debugging (some) application startup code paths. Only has an effect when `--jsdebugger` is also supplied. --devtools Open DevTools on initial load. --start-debugger-server [ws:][ | ] Start the debugger server on a TCP port or Unix domain socket path. Defaults to TCP port 6000. Use WebSocket protocol if ws: prefix is specified. --recording Record drawing for a given URL. --recording-output Specify destination file for a drawing recording. --remote-debugger [][:] --remote-debugging-port Start the Firefox remote agent, which is a low-level debugging interface based on the CDP protocol. Defaults to listen on localhost:9222. -g or --debug Start within debugger -d or --debugger Specify debugger to start with (eg, gdb or valgrind) -a or --debugger-args Specify arguments for debugger
Conclusion
You should know that how to run Firefox web browser from the command line in your CentOS or Ubuntu Linux.
Command line options
Command line options are used to specify various startup options for Mozilla applications. For example, if you have multiple profiles you can use command line configuration options to bypass the Profile Manager and open a specific profile. You can also control how Mozilla applications open, which components open initially, and what the components do when they open. This page describes the commonly used options and how to use them. You can open the command line interface by pressing Shift+F2.
Syntax rules
But first, let’s describe the syntax rules that apply for all options.
- Command parameters containing spaces must be enclosed in quotes, such as «Joel User».
- Command actions are case insensitive.
- Command parameters, except profile names, are case insensitive.
- Blank spaces ( ) separate commands and parameters.
Using command line options
Command line options follow the command to start the application. If the option contains arguments, enter the argument after the option. Some options have abbreviations, for example, -editor can be abbreviated as -edit (available abbreviations are described in the text below). In some cases, option arguments must be enclosed in quotation marks (this is noted in the option descriptions below). Multiple command line options can be specified. In general, the syntax is as follows:
application -option -option "argument" -option argument
Examples
The following examples show the use of the -ProfileManager command, which will open the profile manager prior to starting Firefox:
Windows
Select Run from Windows start menu. Enter the following command:
macOS
Go to Applications ▶︎ Utilities. Open terminal and enter the following command:
cd /Applications/Firefox.app/Contents/MacOS ./firefox -ProfileManager
If you use Firefox Nightly, you can enter:
cd /Applications/FirefoxNightly.app/Contents/MacOS ./firefox -ProfileManager
Linux
Open a terminal and enter the following command:
cd Firefox installation directory ./firefox -ProfileManager
User profile
-allow-downgrade
Firefox 67’s downgrade protection prevents accidentally starting Firefox in a profile running a later version of Firefox. Depending on changes between the two versions, some files in a profile may not be downwards compatible. Adding this option bypasses downgrade protection.
-CreateProfile profile_name
Create a new profile in the default directory, but do not start the application. The profile will be named profile_name in the profile manager, the profile_name must not contain spaces ( ). Do not run profile_name while running an instance of the application, you can use the -no-remote option to avoid connecting to a running instance.
firefox -CreateProfile JoelUser
-CreateProfile «profile_name profile_dir»
Creates a new profile in the profile_dir directory, but do not start the application. The profile will be named profile_name in the profile manager. Note profile_name and profile_dir are quoted together, and are separated by exactly 1 space (as with the previous syntax, profile_name must not contain spaces).
Do not run profile_dir while running an instance of the application. You can use the -no-remote option to avoid connecting to a running instance.
firefox -CreateProfile "JoelUser c:\internet\joelusers-moz-profile"
Note: profile_dir must not exist and you must not already have a profile called profile_name .
-migration
-new-instance
Open new instance, not a new window in running instance, which allows multiple copies of application to be open at a time.
firefox -new-instance -P "Another Profile"
Note: Not available for Windows; see bug 855899.
-no-remote
Do not accept or send remote commands. Implies -new-instance .
firefox -no-remote -P "Another Profile"
Note: Since Firefox 9, this does really mean what its name implies on all platforms. i.e. instances created with this parameter do not accept or send remote commands, see bug 650078. That means that such instances won’t be re-used. Also when using this argument a new instance is created in any case.
-override /path/to/override.ini
Load the specified override.ini file to override application.ini ( browser/app/application.ini ). This can be used to suppress the migration wizard at startup by loading the following override.ini . Firefox only.
[XRE] EnableProfileMigrator=0
-ProfileManager
Start with profile manager. Short form: -P without a profile name.
-P «profile_name»
Bypass profile manager and launch application with the profile named profile_name . Useful for dealing with multiple profiles.
Note: profile_name is case sensitive. If you don’t specify a profile name then the profile manager is opened instead. You must use an upper case P on Linux with versions older than 7.x, as there lower case invokes purify mode (memory and leak detection). Other platforms accept both upper and lower case.
-profile «profile_path»
Start with the profile with the given path. Firefox, Thunderbird and SeaMonkey2.x only.
«profile_path» can either be an absolute path ( «/path/to/profile» ) or a relative path («path/to/profile» ).
Note: On macOS, specifying a relative path is not supported anymore from Firefox 4.0 and up due to a regression; see bug 673955.
Browser
-browser
Start with the browser component. Firefox and SeaMonkey only.
-foreground
Make this instance the active application.
-headless
Runs Firefox in headless mode, which is very useful for purposes such as debugging and automated testing. Available in Firefox 55+ on Linux, and Firefox 56+ on Windows/Mac OS X.
-new-tab URL
Open URL in a new tab. Firefox and SeaMonkey2.x only.
-new-window URL
Open URL in a new window. Firefox and SeaMonkey2.x only.
—kiosk URL
Open URL full screen without user interface. Firefox 71 and later.
-preferences
Open options/preferences window. Firefox and SeaMonkey2.x only.
-private
Opens Firefox in permanent private browsing mode. Firefox 3.6 and later only.
May not be applicable in older Ubuntu for Firefox 20 and later, confirmed to work in 14.04.
-private-window
Opens a new private browsing window in an existing instance of Firefox. Firefox 20 and later only.
-private-window URL
Open URL in a new private browsing window. If a private browsing window is already open, a new tab is opened in the existing window. Firefox 29 and later only. Does not work in Firefox 31 on linux mint 17 nor on Firefox 48 on Windows 7. URL opens in a non-private window.
-search term
Search term with your default search engine. Firefox and SeaMonkey 2.1 and later only.
-setDefaultBrowser
Set the application as the default browser. Firefox only.
-url URL
Open URL in a new tab or window, depend on the browser option. -url can be omitted. You may list multiple URLs, separated by spaces. Firefox and SeaMonkey only.
Note: When opening multiple URLs, Firefox always opens them as tabs in a new window.
Other components
-devtools
Start with native developer tools opened.
-inspector URL
Start with the DOM Inspector, if installed, and inspect the given URL (where URL is optional).
-jsdebugger
Start application with browser toolbox. That is different to Venkman debugger (see option -venkman).
-jsconsole
-purgecaches
Gecko (layout engine) has a JavaScript cache, which is not reset on startup, this clears it.
-start-debugger-server PORT
Start the debugger server on port. This will enable another instance of Firefox to connect the Firefox developer tools to this Firefox instance. See the article on remotely debugging Firefox desktop.
-venkman
Start with the JavaScript debugger, Venkman, if installed.
The port argument is optional, and if it is omitted, the server will listen on port 6000.
Linux-specific options
Firefox is a GTK app, and as such supports the GTK flags documented here.