How To Use Google Translate From Commandline In Linux

use google translate from commandline

I have stumbled upon this cool utility today, and I couldn’t resist myself to share this to our users. Meet, Translate Shell (formerly known as Google Translate CLI) is 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 depend on Google Translate a lot for both my professional and personal work. Translate Shell utility is very useful handy when it comes to translate words from English to your native language and vice versa from Terminal. Translate Shell 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 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.

chmod +x trans

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

git clone
cd translate-shell/
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 /home/sk/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 displayed in the Terminal.

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


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: Use capital M.

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



Thanks for stopping by!

How can I benefit from this blog:

Have a Good day!!

  • thanks.. for this great informative article..

  • Manavalan Michale

    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

      Which Linux OS are you using?

      • Manavalan Michale

        Ubuntu MATE 16.04

        $ locale

    • SK

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