In this article, I am going to show you how to install Stack Overflow command line interface (SoCLI) on Linux. Stack Overflow is a question and answer website on the topic of computer programming. We can use command line interface to get any information from Linux terminal without using the graphical web interface or terminal browser.
Due to SoCLI is written on Python we need installed python-pip. SoCLI supports python>2.0 so there should be no problems with installing it on any Linux distributive. If there is no python-pip package in your system you can install it using commands below.
$ sudo apt-get install python-pip
# yum install python-pip
Verify pip installation:
$ pip –help
$ pip -V
Now we can install SoCLI
# pip install socli
and start using it by executing
Basic SoCLI syntax is
socli [Arguments] <Query>
Let's make a search with SoCLI example
$ socli for loop in python
Seems it is working good. Let's find something interesting
$ socli nginx balancer
One more feature that can be very helpful is interactive search.
$ socli -iq case in python
This command will look for 'case' in python topics and return top 10 questions.
Now you must enter number from 0 to 9 and select the needed question. Let it be number 3.
One more feature of interactive mode is that you can switch between questions using arrow keys.
Getting question by number
SoCLI allows to get a specific question by its number.
Let it show us the third question of query
$ socli -r 3 -q unix
Another Stack Overflow CLI feature is searching using tags with -t key. For example:
$ socli -t linux -q iptable
You can combine any tags just separating them with commas.
Creating your own question
Stack Overflow command line interface allows you to create your own questions.
$ socli -n
Executing this command will open a new question page in the browser.
To get any additional help you can type
$ socli -h
For any additional information, you can refer to SoCLI on GitHub