How To Use Google Translate From Commandline In Linux

use google translate from commandline

Howdy fellow Linux users! I have just stumbled upon this cool utility, and I couldn’t resist myself to share it with you all. Meet, Translate Shell (formerly known as Google Translate CLI), a command-line translator powered by popular translation engines such as Google Translate (default), Bing Translator, Yandex.Translate and Apertium etc. It allows you to access one of these translation engines from your terminal. Google Translate is my first preferred source to translate English to Tamil and vice versa. Since I am not a native English speaker, I mostly depend on Google Translate for both my professional and personal use. Translate Shell utility is very useful handy when it comes to translate words from English to your native language and vice versa from Terminal. It will work on most modern operating systems, including GNU/Linux, FreeBSD, MS Windows, and Mac OS X.

In this tutorial, we will be discussing how to translate a word, a sentence, or even a webpage from your preferred language to English and vice versa. Let’s get started!

Use Google Translate From Commandline In Linux using “Translate Shell”

Install Translate Shell

Translate Shell is available as self-contained executable file. Just download and make it as executable and start using it.

$ wget
$ chmod +x trans

Or, you can clone it from the git repository, compile and install it as shown below.

$ git clone
$ cd translate-shell/
$ make
$ sudo make install

How to use Translate Shell

To translate a word, just type:

$ trans வணக்கம்

Sample output:



Translations of வணக்கம்
[ தமிழ் -> English ]

 Hello, Greetings, Good, Hi, Salute

As you see in the above output, I have translated a Tamil word “வணக்கம்” (Vanakkam), which is used to greet people, to English. Please note that if you have downloaded self-contained executable file, you need to run “./trans வணக்கம்” (without quotes, of course).

To translate a whole sentence at once, Just type ‘trans’ command followed by the sentence within quotes like below.

$ trans "எப்படி இருக்கீங்க?"

Sample output:

எப்படி இருக்கீங்க?
(Eppaṭi irukkīṅka?)

How are you?

Translations of எப்படி இருக்கீங்க?
[ தமிழ் -> English ]

எப்படி இருக்கீங்க?
 How are you?

As you see in the above example, Translate Shell gives you the detailed translation of the given sentence.

To get the brief translation of the given sentence, type the sentence with -brief parameter as shown below.

$ trans -brief "எப்படி இருக்கீங்க?"

The sample output would be:

How are you?

This above command will just display the actual translation.

I want to translate a whole text file to English, is it possible? Yes you can.

Let us see the contents of text file

$ cat greet.txt

Here is what I have in the text file.

வணக்கம். எப்படி இருக்கீங்க?

To translate this text file, just type:

$ trans file:///home/sk/greet.txt

Sample output:

Hello. How are you?

Cool isn’t it?

As you noticed, all the translations that we did till now are from other languages (Tamil in my case) to English. If you want to change the target language, type :(colon) followed by specific language code.

Say for example, to translate a word to Hindi, just type:

$ trans :hi வணக்கம்

This command will translate the Tamil word “வணக்கம்” to Hindi language.

Sample output:



Translations of வணக்கம்
[ தமிழ் -> हिन्दी ]

 नमस्ते, करें Hello, नमस्कार, Hello

If you don’t know the language code, type:

$ trans -R

Just pick any language of your choice and translate the sentence instantly. You don’t need a web browser. Everything will be displayed right from your Terminal.

What about translating a website? That’s also possible.

$ trans

This command will open a new browser window and translate the website into English. Since the above website is already in English, It just displayed:

The page you have attempted to translate is already in English.

To translate site to some other language, for example Hindi, just type:

$ trans :hi


That’s all for today. We know now all the important functions of Translate Shell. For more details, type:

$ trans -M

Note: Here M is capital letter.

Hope this help. Have you used Translate Shell already? Great! Let us know about your experience in the comment section below.

And, that’s all for now folks. More good stuffs to come. Stay tuned!



Thanks for stopping by!

Help us to help you:

Have a Good day!!

5 Responses

  1. How Mate says:

    thanks.. for this great informative article..

  2. Manavalan Michale says:

    My Command Line not display properly tamil fonts. Please share how to set tamil fonts in command line. My Vivaldi browser and gedit editor show clearly. But command line not showing clearly.

    • SK says:

      Which Linux OS are you using?

      • Manavalan Michale says:

        Ubuntu MATE 16.04

        $ locale

    • SK says:

      Install Tamil fonts. sudo apt-get install ttf-tamil-fonts.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.