What would be a convenient way to open Firefox in a separate, named instance which doesn't use my current preferences, whats the best way to do this?
2 Answers
If you specify an alternate home directory in a separate shell and run a new instance of Firefox from that same shell, that will achieve the outcome you're looking for.
i.e.;
export HOME=~/some_alternate_dir && exec firefox --new-instance
I use a script which does this but also gives me the option of running multiple alternate named instances of firefox (these named instances are also re-usable):
#!/usr/bin/env bash
# Check for a maximum of one arg
[ "$#" -gt 1 ] && echo "Usage: \"ffalt [alternate name]\", or;" && \
echo "\"ffalt\" to run default firefox alternate session" && exit
# Alt name = first arg; otherwise alt name = "default"
alt_name="$1"
[ "$alt_name" == "" ] && alt_name="default"
# If XDG_DATA_HOME is set then use this:
alt_ff_home="$XDG_DATA_HOME"/firefox_alts/"$alt_name"
# Otherwise:
[ -z ${XDG_DATA_HOME+x} ] && alt_ff_home="$HOME"/.local/share/firefox_alts/"$alt_name"
# Ensure that the firefox alternates data dir exists
! [ -d "$alt_ff_home" ] && mkdir -p "$alt_ff_home"
# This is where the magic happens
export HOME="$alt_ff_home"
exec firefox --new-instance &
Edit: Based on @xenoid's answer, you could replace the last two lines in the script above with:
exec firefox --profile "$alt_ff_home" --new-instance &
Use the --profile
option to tell firefox to use another user profile:
firefox --profile /path/to/the/alternate/profile
Note that this firefox instance won't have any of you current bookmarks, saved logins, or plugins.