- How to Restart Firefox from the Command Line
- Method 1: Restart Firefox from the Command Line
- Method 2: Reloading Tabs When You Restart Firefox
- Method 3: Restart Firefox from the GCLI
- what is the command to restart firefox from the command line?
- 4 Answers 4
- Update
- It’s a command line but an internal one.
- Some words more
- How can I restart Firefox from the command-line?
- 5 Answers 5
- How to force to restart firefox in a clean way?
- 2 Answers 2
How to Restart Firefox from the Command Line
Users of Linux are more than likely used to seeing Firefox installed on their systems by default, and they might very well type the name of the program in a terminal to start it. The name of the browser in all lower case is enough to start it up, but some users might want to restart it while preserving their current session.
You’ll potentially need to make a change in the Preferences tab if you’d like to do this, but otherwise it’s extremely easy. Mozilla Firefox users might not be aware of the fact that they can also restart their browser from an internal command line that’s unrelated to the general bash shell most Linux users are familiar with.
Method 1: Restart Firefox from the Command Line
You’ll need to have a graphical Linux terminal open to work on this. Search for terminal on the Ubuntu Unity Dash line to start one if you’re using pure Ubuntu. KDE users and those using Cinnamon or MATE, such as in Linux Mint, can click on the Applications menu and then click on Terminal from the System menu. Xfce4 and LXDE users should have a similar experience. Nearly everyone can hold down Ctrl, Alt and T to open a window regardless of desktop environment.
At the command prompt, type killall firefox and push enter to kill all running instances of the Mozilla Firefox browser. Keep in mind that this will close out running browsers without prompting them to approve it, which might surprise users who’ve never tried it before!
Type firefox and push enter to restart the Firefox browser and keep the terminal window active. You can usually safely close the terminal window after you’ve done this. You generally won’t have to add an ampersand to keep the bash shell active, since modern Firefox implementations start from a script. These two commands are all you’ll usually ever need.
Method 2: Reloading Tabs When You Restart Firefox
In most cases, any tabs you had opened before you issued the commands will reload in the new session. However, if you find that Firefox didn’t reload them, then you can select the History menu and select Restore Previous Session. If you find that it’s not consistently loading the tabs, then you can either select the Edit menu and click on Preferences or type about:preferences in the URL line and push enter.
There’s a line that reads When Firefox starts: followed by what behavior the user expects when starting the browser. It’s set to “Show your home page” by default, but you can click on it and change it to “Show your windows and tabs from last time” to ensure that they always come back up. Of course, you can change this behavior however often you’d like by returning to this screen.
Method 3: Restart Firefox from the GCLI
When you’re running Firefox, hold down Shift and push F2 to open up the Graphical Command Line Interface or GCLI. It’s an internal command line that Firefox offers to power user. Type restart and push enter at this prompt to restart Firefox instantly.
This command also accepts a few command line arguments for when you want to restart Firefox in special troubleshooting modes. Typing restart –safemode will restart Firefox in Safe Mode and even give you a special troubleshooting dialog box. Don’t click on the Refresh option if prompted unless you absolutely want to preform a Firefox refresh operation. You can always close the dialog box and then restart Firefox from the Applications menu or from the command line if you want to cancel a safe mode restart without making any real changes at all.
If you’re afraid that you had some cache loading issues in the past, then typing restart –nocache will prevent the cache content from loading when you restart Firefox. This doesn’t actually clear the cache per say the way you might if you were cleaning out browser history, but rather leaves it in place and loads without it.
You’ll hopefully never need to make use of either of these options, and neither of them should be used loosely. Generally, you’ll only ever want to use restart with no other commands after it.
what is the command to restart firefox from the command line?
how to restart firefox from the command-line. I have already given as «firefox». Is this the right command to restart the firefox?
4 Answers 4
First kill all processes that is named Firefox which means killing the existing running firefox then run it again
At least in my version, Firefox doesn’t have a restart option. You can kill the process and then start it again. For example:
If killall doesn’t cut it, you can use pkill instead. Just keep in mind that pkill would kill any process with firefox in its name, though probably that’s not a big concern.
Just a note: This solution does not work when you want to restart Firefox from a non-GUI shell (such as SSH connection).
Update
- about:profiles
then press the Tab button a couple of times to select the Restart Normally or the Restart with Add-ons Disabled button on the loaded page, and finally press Enter . - about:restartrequired then press Enter (it should be already selected else you can always press Tab ).
Under Linux it is possible to use from command line
pkill -f firefox && firefox 2>/dev/null &
killing all the processes with word firefox in the whole (full) command line, redirecting the error log to /dev/null ; maybe after checking with pgrep -fl firefox .
It’s a command line but an internal one.
Press Shift F2 , write restart in the opened bar (at the very bottom), then press enter .
On old versions, e.g. the 41.0.2, it was needed to write the word true too: restart true .
Some words more
It’s possible to force firefox to restart through the Developer Toolbar, usually accessible via Shift F2 or via menu ( Firefox/Tools >> Web Developer >> Developer Toolbar in the English version).
A bar will be opened in the bottom of the page where it will be possible to write the command
It is possible to use restart —nocache true or restart —nocache false in order to force it the refresh of the tabs content or to use the local cached instead. It can result useful the —safemode option too.
You can find some words more and the old synopsis on another answer of mine on SuperUser.
How can I restart Firefox from the command-line?
How can I restart Firefox from the command-line and restore the previous state completely (or as much as possible) after restart? Sure, I can do something like killall firefox; firefox , but that would not restore the session.
5 Answers 5
You can set Firefox to open with the previously open windows & tabs. It should be under Preferences -> General -> «When Firefox starts». Set that to «Show my windows and tabs from last time»:
You should now be able to restart firefox with killall firefox; firefox & and have the same session.
I think you need to do a setting in firefox before you restart it from command line. Go to:
Prefrences->General->When Firefox starts
Show my windows and tabs from last time
then from the command line , restart it the way you like ( may be killall firefox; firefox& ) and you ll get the desired result.
For more advance tuning about session restore you can type about:config in address bar and search for session or restore to change it.
The ‘show my windows and tabs from last time’ setting has been renamed to ‘open previous windows and tabs’ (about:preferences#general)
If you desire to restart Firefox with two or more profiles, this Bash script appears to work consistently:
#!/bin/bash killall -s SIGTERM firefox; sleep 60 firefox -P "user" & firefox -P "default settings" &
Replace the quoted profile names with your own (see about:profiles ). Use the -foreground flag to control which windows appears on top, if desired.
As noted by the other answers, enable the ‘open previous windows and tabs’ setting in the preferences ( about:preferences#general )
The value in sleep 60 (seconds) can potentially be lowered.
How to force to restart firefox in a clean way?
Many times when I upgrade the system under Linux, firefox pops up a window suggesting to restart the program in order to make effective all the changes. When I ignore that windows because of an urgent duty in a second time I’m not able to find it again. Of course I know it’s always possible to exit and restart it manually; in Linux to kill the process with pkill firefox && sync && firefox & , with or without a brutal -9 .
In a similar way in Windows it is possible to use the Task Manager. What I was searching for is an internal solution, a clean one, possibly system independent. How to force to restart firefox in a clean way ? ps> It is possible that when updated external third parties programs firefox will not prompt for restarting, even if it should be recommended.
@user, I don’t know if it was you, but someone is asking to close this question (2015) as a duplicate of another question written later (2018). 😎 .
2 Answers 2
Update:
Now it is possible to do it directly in the url bar, asking for the special page about:restartrequired
It opens a page with a button to restart firefox that should preserve pages, tabs and windows.
Fast Internal answer:
Press Shift F2 , write restart in the opened bar, then press enter .
On old versions, e.g. the 41.0.2, it was needed to write the word true too: restart true .
Some words more:
It’s possible to force Firefox to restart through the Developer Toolbar, usually accessible via Shift F2 or via menu ( Firefox/Tools >> Web Developer >> Developer Toolbar in the English version).
A bar will be opened in the bottom of the page where it will be possible to write the command
It is possible to use restart —nocache true or restart —nocache false in order to force it the refresh of the tabs content or to use the local cached instead.
In a similar way it is possible to force the safe mode upon restart.
Synopsis: restart [—nocache] [—safemode]
Restart Firefox
Options:
[--nocache] (boolean, required) Disables loading content from cache upon restart [--safemode] (boolean, required) Enables Safe Mode upon restart
An alternative way; pick a firefox Add on:
Another option was to pick one of the many add-ons available for Firefox from the add-on page, such as Restart Button, or Restart. that can add a button or a line in the the menu. However these examples are not compatible with Firefox 57 or later.