I am releasing a project to automate the download of common software latest version for Ubuntu (coming soon).
In the meantime...
Downloading the latest version of Slack from the command line is frustrating because there seems to be no official latest tag on the releases one can use. Hence one has to parse the downloads page for the correct link.
This is my solution to this problem:
Ubuntu (saved as
wget -q https://slack.com/downloads/instructions/ubuntu -O - \ | tr "\t\r\n'" ' "' \ | grep -i -o '<a[^>]\+href[ ]*=[ \t]*"\(ht\|f\)tps\?:[^"]\+"' \ | sed -e 's/^.*"\([^"]\+\)".*$/\1/g' \ | grep 'slack-desktop' \ | xargs wget -q -O slack-desktop-latest.deb
Explanation of commands
tr is the unix character translator-- here it translates newlines and tabs to spaces, as well as converts single quotes into double quotes so we can simplify our regular expressions.
<a href="(ADDRESS_IS_HERE)"> on a page.
grep -i makes the search case-insensitive
grep -o makes it output only the matching portions.
sed is the Stream EDitor unix utility which allows for filtering and transformation operations.
sed -e just lets you feed it an expression.
Fedora (saved as
wget -q https://slack.com/downloads/instructions/fedora -O - \ | tr "\t\r\n'" ' "' \ | grep -i -o '<a[^>]\+href[ ]*=[ \t]*"\(ht\|f\)tps\?:[^"]\+"' \ | sed -e 's/^.*"\([^"]\+\)".*$/\1/g' \ | grep 'slack.*rpm' \ | xargs wget -q -O slack-desktop-latest.rpm
MacOS (saved as
wget https://slack.com/ssb/download-osx -q -O slack-desktop-latest.dmg
To get slack in a different language, just add
intl/LANG/ in any of the above urls e.g.
for the Korean version
That's all, thanks!