SoCLI - A Tool to Search Stack Overflow from Linux Terminal

stack overflow command lineIn 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.

Prerequirements

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.
For Ubuntu/Debian:

$ sudo apt-get install python-pip

For RedHat/CentOS:

# yum install python-pip

Verify pip installation:

$ pip –help

or

$ pip -V

Installing

Now we can install SoCLI

# pip install socli 

and start using it by executing

$ socli

socli help

Search

Basic SoCLI syntax is socli [Arguments] <Query>
Let's make a search with SoCLI example

$ socli for loop in python

socli python for loop
Seems it is working good. Let's find something interesting

$ socli nginx balancer

socli nginx balancer

Interactive search

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.
socli interactive mode
Now you must enter number from 0 to 9 and select the needed question. Let it be number 3.
socli interactive mode
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

socli question number

Tags

Another Stack Overflow CLI feature is searching using tags with -t key. For example:

$ socli -t linux -q iptable

socli tag search
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

About Pavlo Maiorchyk

Systems Administrator and hardware developer with 4 years of professional experience in IT. My goal is to deliver only best solutions and customer support.

Author Archive Page

Have anything to say?

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

All comments are subject to moderation.

1 Comment