telegram-cli (8) - Linux Manuals

telegram-cli: Command-line interface for Telegram messenger


telegram-cli - Command-line interface for Telegram messenger


telegram-cli -k <public-server-key>

By default, the public key is stored in /etc/telegram-cli/
Remember to put your international area code before the phone number:


e.g. for Italy: +391234567890

 Telegram messenger is a cloud-based instant messaging designed for
 smart phones and similar to Whatsapp but more flexible, and
 powerful. You can send messages, photos, videos and documents to
 people who are in your phone contacts (and have Telegram). Telegram
 also supports secret chats whose provide a private (encrypted) way of

This package contains a command-line based client for Telegram with the following features:

 Colored terminal messages.
 Message management: history, stats, etc.
 Group chat: create and manage groups.
 Secret chat: secured and encrypted conversations.
 Contact management: add/edit/remove contacts.
 Multimedia support: send/load photos and videos.

Supported commands

* Messaging

msg <peer> Text - Sends message to this peer
fwd <user> <msg-seqno> - Forward message to user. You can see message numbers starting client with -N
chat_with_peer <peer> - Starts one on one chat session with this peer. /exit or /quit to end this mode
add_contact <phone-number> <first-name> <last-name> - Tries to add contact to contact-list by phone
rename_contact <user> <first-name> <last-name> - Tries to rename contact. If you have another device it will be a fight
mark_read <peer> - Mark read all received messages with peer
delete_msg <msg-seqno> - Deletes message (not completly, though)
restore_msg <msg-seqno> - Restores delete message. Impossible for secret chats. Only possible short time (one hour, I think) after deletion

* Multimedia

send_photo <peer> <photo-file-name> - Sends photo to peer
send_video <peer> <video-file-name> - Sends video to peer
send_text <peer> <text-file-name> - Sends text file as plain messages
load_photo/load_video/load_video_thumb/load_audio/load_document/load_document_thumb <msg-seqno> - Loads photo/video/audio/document to download dir
view_photo/view_video/view_video_thumb/view_audio/view_document/view_document_thumb <msg-seqno> - Loads photo/video to download dir and starts system default viewer
fwd_media <msg-seqno> - Send media in your message. Use this to prevent sharing info about author of media (though, it is possible to determine user_id from media itself, it is not possible get access_hash of this user)
set_profile_photo <photo-file-name> - Sets userpic. Photo should be square, or server will cut biggest central square part

* Group chat options

chat_info <chat> - Prints info about chat
chat_add_user <chat> <user> - Add user to chat
chat_del_user <chat> <user> - Remove user from chat
rename_chat <chat> <new-name>
create_group_chat <chat topic> <user1> <user2> <user3> ... - Creates a groupchat with users, use chat_add_user to add more users
chat_set_photo <chat> <photo-file-name> - Sets group chat photo. Same limits as for profile photos.

* Search

search <peer> pattern - Searches pattern in messages with peer
global_search pattern - Searches pattern in all messages

* Secret chat

create_secret_chat <user> - Creates secret chat with this user
visualize_key <secret_chat> - Prints visualization of encryption key. You should compare it to your partner's one
set_ttl <secret_chat> <ttl> - Sets ttl to secret chat. Though client does ignore it, client on other end can make use of it
accept_secret_chat <secret_chat> - Manually accept secret chat (only useful when starting with -E key)

* Stats and various info

user_info <user> - Prints info about user
history <peer> [limit] - Prints history (and marks it as read). Default limit = 40
dialog_list - Prints info about your dialogs
contact_list - Prints info about users in your contact list
suggested_contacts - Print info about contacts, you have max common friends
stats - Just for debugging
show_license - Prints contents of GPLv2
help - Prints this help get_self - Get our user info

* Card

export_card - Print your 'card' that anyone can later use to import your contact
import_card <card> - Gets user by card. You can write messages to him after that

* Other

quit - Quit
safe_quit - Wait for all queries to end then quit


telegram-cli Usage

--phone/-u Specify username (would not be asked during authorization)

Specify location of public key (possible multiple entries)
Increase verbosity (0-ERROR 1-WARNIN 2-NOTICE 3+-DEBUG-levels)
Message num mode
Config file name
Use specified profile
Log level
During authorization fetch all messages since registration
disable auto accept of encrypted chats
Lua script file
Send dialog_list query and wait for answer before reading input
Disable color output
Disable readline
Enable bell notifications
Daemon mode
--logname/-L <log-name>
Log file name
--username/-U <user-name>
Change uid after start
--groupname/-G <group-name>
Change gid after start
Disable output
--tcp-port/-P <port>
Port to listen for input commands
--udp-socket/-S <socket-name>
Unix socket to create
--exec/-e <commands>
Make commands end exit
Use user and chat IDs in updates instead of names
Use ipv6 (may be unstable)
Prints this help
Accepts tcp connections from any src (only loopback by default)
Disables server-side previews to links
Bot mode
Prints answers and values in json format



* Python2 bindings

/usr/bin/generate-2 -> /usr/bin/python2.7-generate
/usr/bin/generate-2.7 -> /usr/bin/python2.7-generate
/usr/bin/telegram-cli-2.7 -> /usr/bin/python2.7-telegram-cli
/usr/bin/telegram-cli-2 -> /usr/bin/python2.7-telegram-cli
/usr/bin/tl-parser-2 -> /usr/bin/python2.7-tl-parser
/usr/bin/tl-parser-2.7 -> /usr/bin/python2.7-tl-parser

* Python3 bindings

/usr/bin/generate-3 -> /usr/bin/python3.x-generate
/usr/bin/generate-3.x -> /usr/bin/python3.x-generate
/usr/bin/telegram-cli-3.x -> /usr/bin/python3.x-telegram-cli
/usr/bin/telegram-cli-3 -> /usr/bin/python3.x-telegram-cli
/usr/bin/tl-parser-3 -> /usr/bin/python3.x-tl-parser
/usr/bin/tl-parser-3.x -> /usr/bin/python3.x-tl-parser




Bug tracker:


Vitaliy Vatman (-@-)


How to contact maintainers: