DEV Community

Emmanuel K
Emmanuel K

Posted on

3 2

Download latest version of Slack from the Bash terminal

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 slack-desktop-latest.deb):

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
Enter fullscreen mode Exit fullscreen mode

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.
  • Matching all <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 slack-desktop-latest.rpm):

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
Enter fullscreen mode Exit fullscreen mode

MacOS (saved as slack-desktop-latest.dmg):

wget https://slack.com/ssb/download-osx -q -O slack-desktop-latest.dmg
Enter fullscreen mode Exit fullscreen mode

To get slack in a different language, just add intl/LANG/ in any of the above urls e.g.

https://slack.com/downloads/instructions/fedora
Enter fullscreen mode Exit fullscreen mode

becomes

https://slack.com/intl/ko-kr/downloads/instructions/fedora
Enter fullscreen mode Exit fullscreen mode

for the Korean version

That's all, thanks!

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post