1. Home
  2. Linux

How to use Slack from the command-line on Linux

The official Slack client for Linux is pretty good. It works well, has a clean user interface, and is easy to set up. That said, if you primarily spend time on your Linux PC in the terminal, you may be wishing they had an official command-line app.

Unfortunately, there isn’t any talk of an official Slack app for the terminal on Linux. However, there’s an excellent, unofficial terminal client for Slack known as Slack-term. Here’s how to set it up on your system.

Install Slack-term

Using Slack from the command-line requires the Slack-term application. To install this program, open up a terminal window on your Linux PC by pressing Ctrl + Alt + T or Ctrl + Shift + T. Then, once the terminal window is ready to use, follow the command-line instructions that correspond with the Linux distribution you use.

Arch Linux AUR

If you use Arch Linux, you’ll be happy to know that there’s a Slack-term AUR package available. To start the installation process of the Slack-term AUR package, install “Base-devel” and “Git” with the Pacman command below.

sudo pacman -S base-devel git

After installing both “Base-devel” and “Git,” it’s time to download the latest Slack-term AUR package from the internet using the git clone command.

git clone https://aur.archlinux.org/slack-term.git

When the files are done downloading to your Arch Linux PC, use the CD command to move into the “slack-term” directory.

cd slack-term

Build and install Slack-term on your Arch Linux PC by executing the makepkg command. Be aware that this build may fail. If you need help troubleshooting, refer to the comment section of the package.

makepkg -sri

Snap package

Perhaps the most user-friendly way to install the Slack-term application on Linux is through the Snap package store. Why? It’s easy to update, and it only takes one command to install the app!

To install Slack-term from the Snap store, make sure that you have Snap support set up on your Linux PC. After that, run the snap install command below to set up Slack-term.

sudo snap install slack-term

Generic Linux Binary

The developer of Slack-term has a generic Linux binary release of the program that works on nearly every Linux operating system. This version of the app is perfect if you’re not using Arch Linux and can’t use Snap packages.

To start the installation process for Slack-term, use the wget command to download the latest binary release.

wget https://github.com/erroneousboat/slack-term/releases/download/v0.4.1/slack-term-linux-amd64

After the Slack-term file is done downloading to your Linux PC, use the chmod command to update its permissions.

sudo chmod +x slack-term-linux-amd64

With the permissions to Slack-term up to date, follow the steps in the next section to learn how to configure the app.

Configure Slack-term

Slack-term requires some configuration before it will run correctly. The first thing you must do is create a new Slack-term configuration file. Using the touch command, create the file “.slack-term”.

touch ~/.slack-term

After creating the new config file, open it up in the Nano text editor.

nano -w ~/.slack-term

Paste the following code into the configuration file. You can paste items into Nano by pressing the Ctrl + Shift + V on the keyboard.

{
"slack_token": "yourslacktokenhere"
}

Head over to the Slack API website and log into your account. Once logged in, create a new legacy token. Paste the token code into Nano where “yourslacktokenhere” is. Do not remove the ” “ marks!

When the token is in the configuration file in Nano, save the edits by pressing Ctrl + O on the keyboard. Then, exit the Nano text editor by pressing Ctrl + X.

Use Slack from the command-line

Using Slack-term from the command-line is surprisingly easy, even though it’s done in the Linux terminal. To access your Slack messages, type in the slack-term command.

slack-term

Did you download the generic binary? If so, you must execute Slack-term with the command below instead, as the one above will not work correctly.

./slack-term

Slack-term, when launched, will bring you to your Slack workspace, in the default channel, complete with message history, etc. To start chatting with people on the default channel, start typing. Send messages by pressing Enter.

Hotkeys

Slack-term has several different keyboard shortcuts. So many that it might be challenging to figure them out on your own. Here are all of the hotkeys and what they do.

Note: all hotkeys are case-sensitive.

  • i –  insert mode.
  • /  – search mode.
  • k – move channel cursor up.
  • j – move channel cursor down.
  • g – move channel cursor top.
  • G – move channel cursor bottom.
  • pg-up –  scroll chat pane up.
  • ctrl-b – scroll chat pane up.
  • ctrl-u – scroll chat pane up.
  • pg-down – scroll chat pane down.
  • ctrl-f – scroll chat pane down.
  • ctrl-d – scroll chat pane down.
  • n – next search match.
  • N – previous search match.
  • q – quit.
  • f1 – help.
  • insert left – move input cursor left.
  • insert right – move input cursor right.
  • insert enter – send a message.
  • insert esc – command mode.
  • search esc – command mode.
  • search enter – command mode.

Leave a comment