From the Firefox documentation pages:
Please use download.mozilla.org to retrieve the latest Firefox release. For example, if you wish to download the US English installer for Windows (32bit) the url is https://download.mozilla.org/?product=firefox-latest&os=win&lang=en-US This could be pasted into the location bar of a browser, or used with curl or wget, e.g. wget -O FirefoxSetup.exe "https://download.mozilla.org/?product=firefox-latest&os=win&lang=en-US" For other operating systems replace 'os=win' with: Windows 64bit os=win64 OS X os=osx Linux x86_64 os=linux64 Linux i686 os=linux Source, with more language codes listed: http://archive.mozilla.org/pub/firefox/releases/latest/README.txt
So, the one-liner to download the latest Firefox for Linux is:
wget -O firefox-latest.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US"
Note! The contents below in this document was an simplistic experimental version of the script. For the most up to date version of the script please refer to the update-firefox-linux.sh file below (a second file in this gist).
In order to download and run the script, use the below command:
curl -s https://gist.githubusercontent.com/mikbuch/ee30a18b9738da8a51039ce0875c093c/raw/7ffe59592b464deec8dca6de02d3cf28e2c452ff/update-firefox-linux.sh | sudo bash
Source on how to run bash script from an URL (via HTTP(S)): Baeldung Linux post
# Remove backup, if there is any
sudo rm -rf /opt/firefox_bak
# Download the latest version of the Firefox browser (use the `/tmp` directory to save the tarball there)
wget -O /tmp/firefox-latest.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US"
# Backup the old version of the Firefox
sudo mv /opt/firefox /opt/firefox_bak
# Untar the new Firefox
sudo tar xjf /tmp/firefox-latest.tar.bz2 -C /opt
# Remove the tar from the `/tmp` directory
rm -r /tmp/firefox-latest.tar.bz2
Additional materials:
bash oneliner with a curl HEAD Request to get the info and cut to parse it from the location header
PRODUCT=firefox-latest;OS=win;LANG=en-US;curl -s -I "https://download.mozilla.org/?product=$PRODUCT&os=$OS&lang=$LANG" -o/dev/null -w '%{redirect_url}' | cut -d'/' -f7
Output:
102.0
Modify arguments (PRODUCT, OS, LANG) as required.
PPA Firefox Canonical
https://ubuntuhandbook.org/index.php/2022/04/install-firefox-deb-ubuntu-22-04/
https://launchpad.net/~ubuntu-mozilla-security/+archive/ubuntu/ppa