2 Easy Ways to Install Telegram-CLI on Linux


In today’s digital age, instant messaging has become a very important part of our daily communication. Though many users prefer using the graphical interface, there are some individuals who love efficiency and believe in the power of CLI.

Telegram-CLI, also known as tDesktop, is a great and powerful tool to send messages over CLI for the popular messaging platform Telegram. While many users are familiar with the user-friendly Telegram application, the CLI version provides a unique experience for those who prefer command-line interactions.

It allows users to access Telegram’s features directly from the terminal and is a lightweight and efficient way to communicate without the need for a graphical user interface. Here we will explore the uses of telegram-CLI, the step-by-step installation process, and its advantages for various user scenarios.


Uses of Telegram-CLI:

  • Efficiency and Resource Optimization: As compared to the graphical interface, the telegram CLI is more lightweight and efficient. This results in an ideal choice for the users who need efficiency and are comfortable using the Command line. 
  • Automation and Scripting: One of the key strengths of Telegram-CLI is its compatibility with scripting and automation. Users can integrate Telegram-CLI into their scripts, which enables them to perform a wide range of Telegram actions programmatically. This is particularly valuable for users who want to automate repetitive tasks or integrate telegram into larger workflows.
  • Server Environments: In server environments where a graphical user interface may not be available, the Telegram-CLI provides a simple and convenient way for administrators and users who need to send messages, receive notifications, handle automations, or perform other Telegram actions directly from the command line.

Now, let’s move to the next section, where we learn the step-by-step installation process for Telegram-CLI on a Linux system.


How to Install Telegram-CLI on Linux?

1. Build from the Source Code

Step 1.   Install Required Dependencies:

Begin by ensuring that your system has the necessary dependencies installed. Open a terminal and run the following commands:

sudo apt-get update
sudo apt-get install -y libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make

These dependencies are important for building and running Telegram-CLI. Make sure to replace the package manager commands with the appropriate ones for your Linux distribution, if needed.

Install the required dependencies
Install the required dependencies

Step 2.  Clone the Repository:

Clone the Telegram-CLI repository from GitHub using the following command:

git clone --recursive https://github.com/vysheng/tg.git && cd tg

This command not only clones the repository but also fetches any submodules it depends on.

Clone the repository
Clone the repository

Step 3.   Build the Telegram-CLI:

Configure and build the Telegram-CLI with the following commands:

./configure
make
Run the following command
Run the following command

This process may take some time, as it involves compiling the source code. Ensure that there are no errors during the build process.

Finally, build the application
Finally, build the application

Step 4.  Run Telegram-CLI:

Execute Telegram-CLI with the command:

./bin/telegram-cli
Running Telegram CLI
Running Telegram CLI

Telegram-CLI will prompt you to enter your phone number and a confirmation code to authenticate your account. 

Step 5.   Enjoy Using Telegram-CLI:

Once authenticated, you can start using Telegram-CLI for various actions like sending messages, joining channels, and exploring its features. To get a list of available commands, type:

/help

2. Installation Using Package Managers

Here are general steps that you can try for Ubuntu/Debian based systems. Note that these steps may not work for all distributions, and in that case it’s essential to refer to the latest documentation for your specific Linux distribution.

  • For Apt:

Use the package manager to install the Telegram-CLI.

sudo apt-get install telegram-cli
Installing Telegram CLI using the APT command
Installing Telegram CLI using the APT command

Telegram-CLI might be available as Snap or Flatpak package. These are distribution-agnostic package formats that work on various Linux distributions. You can install Snap or Flatpak if you don’t have them and then search for Telegram-CLI:

  • For Snap:
sudo snap install telegram-cli
This application can also be installed from the snap store
This application can also be installed from the snap store

Conclusion:

To sum up, Telegram-CLI provides a flexible and effective command line interface for utilizing the Telegram chat network. Telegram-CLI meets a range of user needs, including resource optimization, automation, and server environment functionality.

By now, you will have successfully installed Telegram-CLI on your Linux machine and are now able to utilize the power of command-line communication by following the instructions provided. Accept the adaptability and effectiveness that Telegram-CLI provides, and discover the countless opportunities that text-based communications offers.


References: