Using Telegram from the terminal

By now, surely more than one of you have heard and / or read about Telegram, the new messaging system that rivals the ubiquitous (and unsafe) Whatsapp.
You will also know that it is Free Software and that both the program and its API are free (except for the server, although it seems that it could also be released)
In this article I will explain the steps to follow to install and use the client for the terminal, which is still under development, but which we can use without much trouble.

Installation:

If you are a user of Archlinux or derivatives you can install it from AUR via package telegram-git, therefore you can skip this step. Besides in the program's repository you can find a package rpm, as well as to generate the package for Gentoo, Debian and derivatives.

To compile we will need the following packages (apart from GCC, autotools and others):

  • Go
  • openssl
  • moon
  • libconfig
On some distros, like Debian or Ubuntu, openssl is how libssl. Besides, remember to install the libraries that end in -dev o -devel.

Once the dependencies are installed, we open a terminal and move to the folder where we will clone the repository:
git clone https://github.com/vysheng/tg.git
Now we move to the newly created folder, tg, and execute:

./configure
make

If nothing has failed, we will have the program compiled.
To test it we execute:
./telegram
We will get a screen like this asking us for our phone number to send us a message with the verification code:

telegram-home

Once the code is entered, we can use the client.
telegram-session-started

It also has autocompletion, both for the commands and the contacts:
telegram-autocomplete

Inside the ~ / .telegram folder the client's configuration is saved, in addition to a folder where the images, videos, etc. that our contacts send us will be saved (although this must be done by hand through a command).

Basic commands:

  • msg: We send a message to one of our contacts
  • send_photo / video / text: We send an image, video or text file
  • create_secret_chat: We create a secret chat with the indicated contact
  • add_contact: Try to add a contact indicating their phone number

These are some of the available commands. To know the rest, just write help.

The client, even at an early stage, is quite good, if you know how to handle the terminal. The negative point of the moment is that to download what they send us it is necessary to do it manually, also knowing the id of the message. For this we execute the command:
set msg_num 1
and every time we send or receive a message we will get the ID number of the message.

I hope it helps you, waiting for a graphic client to come out for those of you who do not want to use the terminal, or are not used to using it.

Project repository

There is no graphical interface NATIVE for GNU / Linux. If you want to use a graphical interface, you have webogram to use it from a Web navigator. Please, do not ask about the subject again, as soon as one comes out, it will be discussed. Thanks for your understanding.

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   fylux said

    Hi, Telegram is fantastic, it's the best I've ever tried.
    But it is a horror to use it through a terminal with the nice interface that there is in windows so I hope they release a GUI as soon as possible.

    Greetings.

    1.    al_SeveR said

      Although there is no GUI natively for GNU / Linux we can use Webogram »
      http://zhukov.github.io/webogram

      1.    f3niX said

        Apparently if there is an interface for linux https://github.com/vysheng/tg

  2.   matias said

    Brilliant!
    I recently read a tutorial to use wathsapp from pidgin,
    Is there any way to use telegram in pidgin? hug!

    1.    They are Link said

      Well at the moment no, of course I have not found anything, but it would be fine.

  3.   George said

    Great Telegram, but as Fylux says they must implement a graphical interface in Linux! On the other hand, what I don't like is that only one of all my contacts uses it.

    1.    O_Pixote_O said

      But that's a matter of publicizing it and if you can, do it personally, because we all know that laziness is the reason why an insecure and proprietary application continues to be so successful. Some friends of mine and I have duped all of our important friends we talked to to download it and now we have quite a few contacts. What you can't wait is for a saint to come down from heaven and tell them to install them.

    2.    O_Pixote_O said

      One question, is control c to exit? xD

  4.   Dekomu said

    Is there a way to create a telegram account without giving the mobile number?
    I have tried to create an account through a desktop client and it asks for mobile, does the app in google play also ask for it?
    I don't know, but everything that asks me for a mobile number gives me mistrust: /

    1.    O_Pixote_O said

      If it is an application that uses your phone number to create a chat with your contacts, the minimum it will need is your mobile number, in the same way as line, whatsapp, chat, etc. they also ask you. If you want to make it work well, install it on the mobile first because otherwise, most likely, when you start, you will not have any contact.

      1.    Dekomu said

        Passed.
        I don't have any of that for the same reason, I don't know ... I just don't like giving the number.
        Thanks for the information, as I prefer to be "incommunicado" 😛
        Greetings ~

      2.    Chaotic Bushels said

        Telegram also uses nicknames to establish contact between users although it is not mandatory, in reality it would be perfectly possible to create an account based on nickname without an associated phone number, simply by searching your contacts by nickname in the global search.

  5.   Juanpa said

    i have problems with libconfing dependency

  6.   michael said

    Please do not continue to give Telegram fame. It is nothing more than another trap just like WhatsApp. The fact that it is open source is just a strategy for people to believe that it is reliable when in reality the server-side code is proprietary, it uses a closed protocol that is not the XMPP standard, security experts discovered that its encryption algorithm It is the same rand used by the NSA. In addition, its creator is the same as VKontakte, the Russian social network that requires your phone number to use it.
    it is high time that we promote the use of free networks and the free / federated XMPP / Jabber protocol.

    1.    nocturnal said

      Openwengo used XMPP for video conferences. It was multiplatform and of quality at least for its time, but since almost everyone had their friends on msn, it closed the chiriguito after a few years. Google seemed that if Talk was going to go for XMPP, but it almost always ends up killing the open standards it starts with, in this case with Hangouts.

    2.    Patrick said

      And the worst thing is that we Linuxeros do nothing about it. I believe that it is time to promote the use of XMPP for free and decentralized communication and encourage the use of free social networks such as Diaspora *, Pump.io, how is it possible that we allow the most used chat systems in the world are proprietary, closed and controlled by a company that the only thing that wants is to abuse the user with their terms and conditions of use?
      Just as we promote the use of GNU / Linux or events are held on free software, etc. Why can't the same be done for this new threat that is controlling us all lately?

      DesdelinuxPlease be aware of this.

      1.    diazepam said

        XMPP Jabber clients are ugly. Diaspora is full of hippies.

        1.    pandev92 said

          In diaspora it's full of anarchists xd

        2.    elav said

          Pidgin is not ugly. Empathy tries not to be. O_O

      2.    Receding said

        And not only that but we continue to use and promote the use of Google, having Startpage, Ixquick, Duckduckgo and others; We continue to advertise Gmail for free, instead of privacy-friendly services like Openmailbox, Autistici, etc; We also do free advertising for Amazon (it seems that there are no more books / records / gadgets / whatever stores on the net).
        We have to do a consistency test with ourselves and change many habits that do not match at all with the philosophy of free software.

    3.    Receding said

      You're right, but you know someone who has an XMPP chat program (other than Facebook, of course) on his mobile, and an account, of course. I do not. People have the «Guasa», Line, Viber, and stop counting. Telegram is presenting itself as a hundred for WhatsApp, and within not being perfect, it is much less bad than WS. So it is very good that between us we try to use other alternatives, but we do not have to lose contact with reality and accept that our friends are not going to install and configure an XMPP account and client just to talk to us, so not. there is no choice but to use the least bad alternative, and that, for now, is Telegram.

  7.   Miguel-Palacio said

    I assume someone is working on CLI to make a front end, right? It is necessary! I find it strange that no native Linux client has come out yet. Will there be a lot of skepticism with Telegram within the community? I hope not. I would like to see Telegram in KDE-Telepathy for example 😛

  8.   let's use linux said

    Excellent contribution!
    Cheers! Paul.

  9.   NauTiluS said

    Thanks friend, it worked for me instantly. So far the program is going well.

  10.   xuri said

    I have installed the windows client through wine in linuxmint 16 and it works very well, I say it for those who are interested in a GUI in linux

  11.   ianpocks said

    It would be a joy if it could be used with pidgin with xmpp 🙂

  12.   vidagnu said

    The terminal is much faster, I like more the programs that we can run from the command line, thanks for the very complete tutorial.

    Regards,
    Oscar

  13.   George said

    Hello very good post, but I wanted to go further. I would like you to explain how you can run the version of Telegram for linux but with a graphical environment in the telegram app https://telegram.org/apps there are the files.
    In my case it is for OpenSuse 13.1, and I can't install the rpm for lack of a library that I can't find:

    All the best

  14.   Brian said

    I have a doubt. Once the terminal is closed, when I reopen it, how do I run the application again? I know it may be a silly question, but I just don't know how to do it. Thanks a lot!

  15.   Nop said

    Webogram - http://webogr.am

  16.   hey said

    I get
    $./telegram
    Telegram-client version 0.01-beta, Copyright (C) 2013 Vitaly Valtman
    Telegram-client comes with ABSOLUTELY NO WARRANTY; for details type `show_license '.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show_license 'for details.
    ***Lost connection to server… 31.210.235.12:80
    ***Lost connection to server… 31.210.235.12:25

    1.    Brian said

      Go to your personal folder, press Ctrl + H, and delete the .Telegram folder. Be careful, don't delete anything else.

      You will have to do it every time you want to run the application. And re-authenticate via SMS. It's a pain in the ass.

      1.    hey said

        what happened was that the server was down and it works perfect I did not have to touch anything like it gracais

  17.   mankeletor said

    It's WhatsApp, you wrote it wrong in the article. And yes, it could be improved. One flaw is that it does not allow sending through send_audio because that function is not capable of processing spaces in file names, like the examples that I am going to give below:
    This does not work
    "This doesn't work either"
    \ »This neither \»

    \
    Not_even_this_working

  18.   kuk said

    Let's try Thanks !!! 🙂

  19.   gabriel said

    I think the necessary resources are not complete, I don't know where to get
    «To compile we will need the following packages (apart from GCC, autotools and others):

    Go
    openssl
    moon
    libconfig »
    anyway thanks

  20.   Adal said

    Use Manjaro
    And looking for telegram I found this https://aur.archlinux.org/packages/arch-telegram/?setlang=es I installed it and I'm testing, I clarify that it is in alpha phase

  21.   andrezero said

    As it is possible that the graphic version does not yet exist. !

    1.    Brian said

      Develop it. If you don't do it, don't criticize that others don't do it ... 🙂

      1.    jathan said

        Or at least contact the Andrezero developers 😉 If you see that there are people interested in a native Telegram GUI for GNU / Linux, maybe that will further boost your advancement. Telegram CLI is very good. It is similar in some ways to Profanity for XMPP by CLI on GNU / Linux: http://www.profanity.im/index.html Especially with the option to send messages with / msg ja: http://www.profanity.im/basic.html

        I leave you an interesting article about Pavel and Nikolai Durov, who are the founders of Telegram to see what they also think:

        http://www.muycomputerpro.com/2014/02/25/detras-telegram-matematicas

        Greetings and congratulations to the entire community for making this blog one of the best in every way. Long live the brothers of Cuba like Elav and KZKG ^ Gaara for being partners with the rest in this type of achievement. A virtual hug.

        1.    jathan said

          I forgot to mention Pablo also for Let's Use Linux together now with Desde Linux. What a pleasure to be part of this great community.

  22.   Hector Mamani said

    Here from Ubuntu 16.04 x64 this GUI works excellent https://blog.desdelinux.net/tips-para-instalar-popcorn-time-spotify-y-telegram-sobre-debian/
    Now, I am still interested from the terminal to speak from my CHIP uses a distro based on debian 8 :-D.
    I still agree with the comment of using other means to communicate, mm but what do we have left? IRC?

  23.   Cire said

    apt-get install libjansson-dev on Debian also for it to compile