How can I restart firefox from commandline (in linux) such that it restores 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.


I think you need to do a setting in firefox before you restart it from command line. Go to:

   Prefrences->General->When Firefox starts

and select :

   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.



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":

enter image description here

You should now be able to restart firefox with killall firefox; firefox & and have the same session.


Unfortunately, there's no easy way to accomplish this. The closest thing to it would actually be using the Firefox Console (Shift + F2) and typing in restart.

Firefox Console restart function

Aside from that, one could install an Addon or take @terdon's advice in his answer and change Firefox Preferences to "Show my windows and tabs from last time" When Firefox starts and "restarting" with

$ killall firefox; sleep 1; firefox &

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.