Let’s have fun with Linux Terminal today. Also, if you are developer, let’s reduce one context switch that you perform while development; switching to browser for solution in stackoverflow. It's well known fact, less context switch, less distraction and more productivity. In this article we’ll explore two fun and useful things that you can do right through terminal without opening browser that you would do normally.
WEATHER INFO THROUGH TERMINAL IN BEAUTIFUL WAY!
Install curl [optional]
Before you can use the API of wttr.in you need to install curl in your system.
For Debian based system,
sudo apt-get install curl
For fedora based system,
sudo dnf install curl
This is optional installation. Alternatively, you can use wget command to get weather info as explained later in this section.
http://wttr.in/ provides api that returns weather information of location in decorated way. To get weather information,
Open terminal. (shortcut : ctrl + alt + T).
Type command :
You will see weather forecast layout for your location for three days with current wind speed.
To check weather forecast of particular place, you can use command curl wttr.in/place
Getting Weather Forecast Through WGET
If you don't have installed curl, you can use prebundled wget command by getting its output on terminal. By default, wget command stores output in file. You need to use -qO- command line parameter to get output on terminal screen.
wget -qO- wttr.in/Mumbai
SURFING STACKOVERFLOW.COM THROUGH TERMINAL
Claudio Santini, A London based developer had an idea on this line,
why not having stackoverflow.com surfing right through terminal.
An opensource project how2 from Santini (hosted on gthub: here exactly does this. Although the wiki page provides you help in installation of how2, let’s explore this utility.
Install npm. Follow this command
sudo apt-get update
sudo apt-get install npm
sudo apt-get install nodejs
sudo npm install -g how2
NOTE: There is known bug in debian system’s linux. It uses its internal node command instead of nodejs one. In case you encounter error even after successful installation: ERROR : /usr/bin/env: node: No such file or directory
Do the following changes:ln -s /usr/bin/nodejs /usr/bin/node
Using how2 is simple as other linux commands.It takes syntaxt,
how2 [optionaParameters] your Query.
For example if I want to surf how to write if statement in shell script, I would type command:
how2 write if in shell script
To look for more alternatives hit SPACEBAR. You will see list of other related questions where in you can select the most relevant to you.
To find answer for a partcular development language you can use -l param.
how2 reverse list -l java
Tools like how2 and weather api would relieve you from context switching increasing your productivity. Moreover you can get the solution on the fly. Keep exploring the utilities. How2 may not be perfect in all your queries but will surely come handy in solving 95% of your queries. On technical and development perspective, it saves you from opening web browser ( also saving eating up of RAM :D). You can also contribute and raise the issues on the github project of how2. here. That's all for now. Do leave suggestions, comments or questions in the comment section below.