Have you ever wanted to send messages from your Telegram account with the Linux terminal? If so, consider checking out the Telegram-CLI program. It’s a complete re-imagining of Telegram for the Linux terminal. It functions very similarly to the traditional graphical program for Linux, with a key difference. Instead of a nice graphical interface, users can navigate user-to-user chats, public channels, and groups with commands from the terminal.
To be clear, Telegram CLI isn’t for everyone, but if you’re a fan of the service and a terminal nerd this program is too great to pass up. Follow the instructions below to learn how to install and use it on your Linux operating system of choice.
Telegram CLI isn’t distributed on Linux via native packages, so if you want to use this software you’ll need to build it yourself. Before it will build correctly, you’ll need to install important dependency programs and files.
sudo apt install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make
sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make
sudo dnf install lua-devel openssl-devel libconfig-devel readline-devel libevent-devel libjansson-devel python-devel
sudo zypper in lua-devel libconfig-devel readline-devel libevent-devel libjansson-devel python-devel libopenssl-devel
When all of the dependencies are working correctly on your Linux PC, it’s safe to start building Telegram CLI. To start off, use the Git tool to grab the latest source code.
Note: if you do not have Git installed, you may need to do so before continuing on.
git clone https://github.com/vysheng/tg --recursive
Using CD, enter the Telegram CLI source directory.
From here, you’ll need to run the configure tool. This tool will scan your Linux PC, check for dependencies and overall make sure that everything is ready to go. If it fails, read the instructions above again, because you may have done something wrong. Configuration is successful when no errors appear.
Start the build process for Telegram CLI by calling the make command.
Compiling can take a while, so let the terminal run. When the compilation is complete, the terminal will be able to accept typing again.
Installation Via AUR Package
There is no need to build the Telegram-CLI package manually on Arch Linux, as there is an official AUR package. Make no mistake, the program is still being built, but the pkgbuild file is doing all the work for you. To build, follow these instructions.
First, install the Git package on your Arch PC.
sudo pacman -S git
Grab the latest version of the Telegram-CLI AUR package with Git clone.
git clone https://aur.archlinux.org/telegram-cli-git.git
use CD to move to the clone folder on your Arch PC.
Start the build process. Keep in mind that some dependencies may fail to install. If this is the case, go to this page and grab them manually.
Install Via Snap package
Telegram-CLI is easily built via the source code on nearly every Linux distribution. However, sometimes there are problems with the source code and depending on your Linux distribution, you may run into issues building it. If you followed the instructions above and get errors, an alternative route to using this software is by installing the Telegram-CLI snap package.
Using this software via a Snap is a great idea, as the Snap maintainer takes care of all the software issues. Best of all, Snaps run on basically every Linux distribution, so there’s no question you’ll be able to run it. To install Telegram-CLI, first, follow our guide to learn how to install and get Snap packages running on your Linux distribution. When Snaps are running, use this terminal command to install the latest Telegram-CLI package.
sudo snap install telegram-cli
Want to uninstall Telegram-CLI? Try this Snap command.
sudo snap remove telegram-cli
If you have built Telegram-CLI from source, launch it with this command:
bin/telegram-cli -k tg-server.pub
Snap users, run:
As the Telegram terminal interface opens up, you’ll need to log into your account. Logging in via the terminal is a lot like using the official Telegram app on Linux. Enter the phone number connected to your account to continue.
If the number is correct, Telegram will send a login code via other Telegram applications you’re logged into, or via text. Enter the code, and then press the enter key to continue on.
To view Telegram contacts via Telegram-CLI, type in contact_list in the prompt and press the enter key. Using contact_list shows out a list of all the people you’re friends with on Telegram. Understand that it will not show users that are not specifically added.
Want to view chats in progress with Telegram-CLI? Try typing in the dialog_list command. This shows all groups and direct-message chat threads you have open in Telegram. To send someone a message in any of these chats, try:
msg nameofperson messagename
Be sure to also check out the other things that Telegram-CLI can do by typing in help.
Close the Telegram-CLI client at any time by typing quit, or by pressing Ctrl + Z.