Climate - An Ultimate Command Line Tool for Linux Developers

March 10, 2017 | By in OPEN SOURCE TOOLS
| Reply More

Climate is a command-line tool which is developed for Linux Developers. It provides a huge number of tools for the developers to automate their system.  We can also utilize this tool to learn and understand various Unix commands. There is also an option to print each command before they're executed to help you memorize them over time.

In this tutorial, I'll explain on how to install this utility in a CentOS 7 system.

Pre-requisites

This command-line tool has several dependencies to be installed to make it fully functional. It recommends the following packages to be installed on the server.

upower wget curl rar unzip 7z dig git python pip node npm fdupes glances speedtest sensors sshfs http-server httpstat is-up

Some of these packages will be installed automatically during the installation phase in a yum-based or apt-based systems. But remaining packages we need to install manually with the npm or pip package managers.

How to Install climate

There are several methods to install this command-line tool. I'll explain all of them. But to start with, I'm installing this package using Git repository which is the most secure way of this installation. To begin with this method of installation, we need to make sure that we've git installed in our system. If you've not installed Git in your system, you can make use of these commands to install it.

$ yum update
$yum install git -y

Next, we need clone our git repository and initiate the installation command.

$git clone https://github.com/adtac/climate.git
Cloning into 'climate'...
remote: Counting objects: 288, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 288 (delta 0), reused 0 (delta 0), pack-reused 286
Receiving objects: 100% (288/288), 63.59 KiB | 0 bytes/s, done.
Resolving deltas: 100% (178/178), done.
$cd climate
$./install

The default binary location will be in /usr/local/bin/. If you want to customize to a different location, you can give an argument to the install command as ./install [location].

As you can see the installation steps is followed by installing some of the dependencies. But it recommends installing some of them using npm and pip package managers. Let's install those package managers to complete the installation.

First of all, we can install these package managers. I've installed NPM and PIP using these commands below:

$yum install epel-release
$yum install npm
$node --version
v6.9.4
$yum -y install python-pip
$ pip --version
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

Now we can install those missing dependencies like rar, http-server, is-online, is-up, httpstat and speedtest one by one.

1. Rar: Rar package isn't there in our default repository, hence, we need to manually install it using these steps below:

$ wget http://www.rarlab.com/rar/rarlinux-3.8.0.tar.gz
$ tar -zxvf rarlinux-3.8.0.tar.gz
rar/
rar/readme.txt
rar/rarfiles.lst
rar/unrar
rar/rar
rar/license.txt
rar/file_id.diz
rar/order.htm
rar/whatsnew.txt
rar/Makefile
rar/rar.txt
rar/technote.txt
rar/default.sfx
rar/rar_static
$ cd rar
$ make
mkdir -p /usr/local/bin
mkdir -p /usr/local/lib
cp rar unrar /usr/local/bin
cp rarfiles.lst /etc
cp default.sfx /usr/local/lib
$ make install
mkdir -p /usr/local/bin
mkdir -p /usr/local/lib
cp rar unrar /usr/local/bin
cp rarfiles.lst /etc
cp default.sfx /usr/local/lib

2. Installing some of the missing npm packages manually.

$npm install http-server
$npm install is-up
$npm install is-online

3. Installing some of the missing pip packages manually

$pip install --upgrade pip
$ pip install httpstat
Collecting httpstat
Downloading httpstat-1.2.1-py2-none-any.whl
Installing collected packages: httpstat
Successfully installed httpstat-1.2.1
$pip install speedtest-cli
Collecting speedtest-cli
Downloading speedtest_cli-1.0.2-py2.py3-none-any.whl
Installing collected packages: speedtest-cli
Successfully installed speedtest-cli-1.0.2

Now we can re-run the installation command to confirm the installation of the dependencies as well.

[root@li86-14 climate]# ./install
┌───────────────────┐
│ climate installer │
└───────────────────┘

Alright, let's get started with a few questions. Just press enter if you want to use the default value.

RED GREEN BLUE YELLOW PLAIN
• The above text is colored. Do you want to enable colors in climate? [yes | no] yes

• Show commands before execution? [yes | no] yes

• What's your favourite editor? [vi]

Great. Now, let's check if you have the all requirements:

• upower exists!
• curl exists!
• rar exists!
• unzip exists!
• 7z missing. Installing... Installed!
• xdg-screensaver missing. Installing... Installed!
• dig exists!
• git exists!
• python exists!
• pip exists!
• node exists!
• npm exists!
• fdupes exists!
• glances exists!
• sensors exists!
• sshfs exists!
• gawk exists!
• jq exists!
• http-server exists!
• is-up exists!
• is-online exists!
• speedtest exists!
• httpstat exists!

Neat! You're all set. Run 'climate' to see the whole list of commands supported. Enjoy!

Hurray! that's all what we have to do. We just need to run the command "climate" to explore more options.

$ climate
┌────────────────────────────────────────┐
│ climate - command line tools for Linux │
└────────────────────────────────────────┘
Meta:
climate help show this help and exit
climate update update your climate install
climate uninstall uninstall climate :(
climate version display the version and credits

Info:
climate weather [location] get the weather

General:
climate battery display remaining battery
climate sleep put computer to sleep
climate lock lock computer
climate shutdown [minutes] shutdown the computer
climate restart restart the computer
climate time show the time
climate clock [remove] put a console clock in the top right corner
climate countdown <seconds> a countdown timer
climate stopwatch a stopwatch
climate ix pipe output to ix.io

Alternative installation method

You can also install it using curl and wget, but this can be insecure methods of installation.

$ bash -c "$(curl -fsSL https://raw.githubusercontent.com/adtac/climate/master/install)"

$ bash -c "$(wget https://raw.githubusercontent.com/adtac/climate/master/install -q -O -)"

This should automatically look for dependencies and install them. After the installation, you can run the command "climate" to see the whole list of commands supported as above.

Usage Examples

Let's check out the execution of some of the commands to confirm its working.
1. climate weather: Display weather of a specific location.

Syntax : climate weather [localtion]

$ climate weather india
+ curl -s wttr.in/$commandargs | head -n 7 && printf "\n"
Weather for City: New Delhi, India

Haze
_ - _ - _ - 77 °F
_ - _ - _ ↙ 6 mph
_ - _ - _ - 3 mi
0.0 in

$ climate weather America
+ curl -s wttr.in/$commandargs | head -n 7 && printf "\n"
Weather for City: America, Mexico

\ / Clear
.-. 46 – 50 °F
― ( ) ― ↙ 8 mph
`-’ 6 mi
/ \ 0.0 in

 

2. climate memory : Displays the memory usage.

$ climate memory
0.2G / 1.0G used

3. Verify your status:

$ climate is-online
✔ Online

4. List out the open ports

$climate ports
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 14248 root 3u IPv4 31265 0t0 TCP *:22 (LISTEN)
sshd 14248 root 4u IPv6 31274 0t0 TCP *:22 (LISTEN)

 Conclusion

I hope you enjoyed reading this article. This would be an excellent teaching tool to learn the "real"  linux commands. This tool aids the developers to automate their systems using various options. I believe this will be a great help for the Linux lovers. Please post your valuable comments and suggestions on this.

Filed Under : LINUX HOWTO, OPEN SOURCE TOOLS

Tagged With : , ,

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.