DEV Community

Alfonso Strotgen
Alfonso Strotgen

Posted on

Download the latest release file from a Github repo

I have a simple post installation bash script for the software I use in my personal computer. I usually do a fresh install of Ubuntu / Pop!_OS for every new major release, so this file comes in very handy.

For the most part, this script consists of the typical sudo apt install ..., but there are some applications that are only distributed in .deb or similar packages. For example, to use Anki, the open-source flashcard program, you have to download a compressed file from their official Github repo and install it from source. To download the latest version, I use the following command:

wget -qO - https://api.github.com/repos/ankitects/anki/releases/latest \
| grep browser_download_url \
| grep amd64 \
| cut -d  '"' -f 4  \
| wget -cqi - -O Anki.tar.bz

To use this command, change accordingly:

  • Change ankitects/anki for the repo you need.
  • Change amd64 for the file name you need. In my case, the Linux files in the Anki repo have amd64 in their name. You could use deb, dmg, etc.
  • Change Anki.tar.bz for the name of the file you want. This is useful when the file name includes the version. I use this for running other commands as a next step, for example, uncompressing the file.

Top comments (0)