How To Use StackOverflow Inside Your Terminal Window?

How To Use StackOverflow Inside Your Terminal Window

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.

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:

Install npm:

  1. $ sudo apt-get update
  2. $ sudo apt-get dist-upgrade

Install nodejs:

  1. $ sudo aptget install nodejs
Install How2:
1. $ sudo npm install g how2

The above-mentioned steps will install How2 tool on your system.

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:

1. 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:
1. 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:

1. how2 implement if in shell script
You’ll be getting the output screen on Mac something like this:
stackoverflow-in-terminal
To get more options, you can press spacebar to launch the interactive mode to get a list of StackOverflow question/answers.

 

You may also like...