Discord Install and Update Script for Debian

debian linux bash

2024-04-07

Using Discord on Debain is great. Howeveer, when Discord has one of its frequent updates it will not open until the most recent version is installed. Althought the steps to update Discord are not lengthy, I found it convenient to write a short bash script and asign it to an alias to make my life a little easier.

The Script

I created a Scripts directory to keep things organized, but this script can live anywhere. To create the script either type touch update_discord.sh to create a file to then open in your text editor of choice, or type vim update_discord.sh to create and open the file in vim. (You can substitute ‘vim’ for ‘nano’ if that’s your preference.)

Here is the script:

#!/bin/bash

cd ~/Downloads
wget "https://discord.com/api/download?platform=linux&format=deb" -O discord.deb
sudo apt install ./discord.deb
rm discord.deb

The first step of changing to the Downloads directory is probably unnecessary, but again, it helps me feel organized. Next, the Debian specific Discord package is downloaded and renamed discord.deb. Then the command to install it is executed. Finally, the script removes the package leaving everything nice and clean.

Make Script Executable

The script needs to be executable by the user. To do so type: chmod u+x update_discord.sh

The Alias

Finally create an alias in your .bashrc file to run the script with a short command. I used udis, but you can use whatever works best for you. Here is the alias:

alias udis='sudo ~/Scripts/update_discord.sh'

I run the command with sudo so that the script isn’t interrupted with the need for me to enter my password during the install phase.

CREDITS

My script uses the installation process described in this article from Linux Capable.


Thank you for reading. I hope you find this tutorial helpful! If you have any comments or corrections, please let me know. I can be found on LinkedIn and Mastodon.




Go Back