SoCLI - A Tool to Search Stack Overflow from Linux Terminal

stack overflow command line

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

$ sudo apt-get install python-pip

For RedHat/CentOS:

# 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

$ socli
socli help


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


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

2 Comments... add one

  1. I installed socli and verified it was installed with 'pip list'. But the command 'socli' is not found. I tried again in another terminal. Any ideas? Many of the other entries in 'pip list' are not valid commands (the only exception I found was also installed from the package manager.) I assume this is a path issue. I used 'pip show socli' to find the installation location; from there, will execute, but it gave an error that another (installed) package was not found. I added their common directory to my PATH, but nothing changed.


Leave a Comment