Short Bytes: Using StackOverflow to solve your doubts right from the terminal window is very easy. You need to download a small tool and use a simple syntax to search StackOverflow questions without leaving the world of the terminal. Go ahead and give it a try.
Man pages of Linux are limited to the operating system and you can access them anytime in your terminal. But, what to do if you want to get some specific answer related to some programming language or anything else? You’ll be opening your web browser and typing in the query to get the answer.
Well, if you are a terminal animal, then there’s a way to access StackOverflow right from the terminal itself. In this article, I’ll be telling you how to do that and make your terminal session more interesting.
How to access StackOverflow from your Linux Terminal?
Using a simple script, surfing StackOverflow in Terminal becomes an easy task. If you spend a lot of productive time in the terminal, you need to install how2 on Ubuntu-based distros to achieve this functionality.
To install the how2 command, you need to execute following steps:
$ sudo apt-get update $ sudo apt-get dist-upgrade
$ sudo apt-get install nodejs
$ sudo npm install -g how2
Note: It’s possible that your Linux distribution makes use of nodejs instead of node. So, you need to make a symlink in order to make things work:
ln -s /usr/bin/nodejs /usr/bin/node
For installing How2 tool on your macOS terminal, you need to install node with brew using the following command:
brew install node.
Install How2 using the same Linux command as mentioned above.
Now, to use the tool, you can search StackOverflow by using how2 command followed by the desired query:
how2 implement if in shell script
To get more options, you can press spacebar to launch the interactive mode to get a list of StackOverflow question/answers.
To get more information about this tool and its usage, you can head over to How2’s GitHub page.
Did you find this article interesting? Don’t forget to drop your feedback in the comments section below.