Betty, the Siri-Like Helper for Linux Command Line

Most Linux users know that the power of Linux lies in the command line. Almost any and everything that you can do through GUI has a command line alternative in Linux. While that’s certainly good, it also poses a challenge for Linux users (both new and experienced): you need to remember so many commands.

What if you want to do a certain task through command line but do not remember or know specifically which command is to be used? Easy, you’ll just Google it. Now, imagine a scenario where you don’t have access to the Internet, and the task you have to do is very high priority and critical (like this)

tar

What will you do then?

Thankfully, a tool exists, Betty, that’s built specifically to help you use the Linux command line through natural language input. In this article we will discuss the basics of Betty as well as the features it provides.

What exactly is Betty? Well, it considers itself to be a “friendly” English-like interface for the Linux command line. With Betty, all you have to do is to put up your query in an English-like phrase, and the tool will translate it to the corresponding command. iOS users can think of Betty as a kind of Siri for the Linux command line.

Downloading and installing Betty isn’t really difficult; all you have to do is to execute the following command:

git clone https://github.com/pickhardt/betty

then add the following alias to your ~/.bashrc.

alias betty="~/[path/to/betty]/main.rb"

Replace [path/to/betty] with the actual path.

and finally, run the following command:

source ~/.bashrc

That’s it. If all the above-mentioned steps are executed successfully, Betty will be installed on your system.

Suppose you want to find the number of words in a file; you can ask Betty to do this for you by writing the following phrase on the command line:

betty how many words are there in [filename]

And the tool will do the necessary work.

Here’s a working example where Betty found the number of words in a file named “changelog.txt:”

betty-num-wrds-ex

Next up, suppose you want to decompress a .tar.gz file. Here’s how you can ask Betty to do it:

betty uncompress [archive name]

Here’s a working example for the same.

betty-uncompress-file-ex

Similarly, you can ask the tool to display the current time.

betty-time-ex

Now, if Betty realizes that there are multiple ways in which it can respond to your query/order, it’ll ask you to select the one you want. Here’s an example for this.

betty-multiple-response-ex

The tool can also bring information from the Web. For example, you can ask it to get the temperature of your city and stuff like that. However, if you’re on a recent Ubuntu version, there’s a little patch that you need to apply before Betty starts responding to the queries that require it to access the Internet. Details on the issue as well as the patch are available here.

Sadly, there’s only a limited set of things that Betty can currently do (for a non-exhaustive list, head here), but – as most of you will agree – the tool’s potential is limitless.

Betty is undoubtedly a very handy tool, especially if you’re new to the Linux command line. However, you need to understand that it’s not a magical wand capable of helping you out in any and every situation. The tool is open source, so anybody can customize it or even extend its functionality to make it even more capable. It’s worth giving a try, I’d say.

Image credit: IMG_2155

Leave a Reply

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.