Table of Contents
In this article, I will take you through 10 Popular Corona-Cli Examples to track Coronavirus Stats in RedHat/CentOS 7. As you know there is a Coronavirus Pandemic hovering across the world which is responsible for causing Many Deaths. In this chaos, we can use Corona-Cli
Command Line Tool to track the number of cases on daily basis. This tool provides number of Important Information such as Number of Cases, No of Deaths, Total number of recovered people, total number of Active Patients etc.
This tool also provides you the capability to use it with any of the Linux scripting languages like bash shell scripting to accomplish some specific tasks.
KEY:-
Country: Name of the country
Cases: Total number of cases in a country
Cases (today): Cases in 24 hours GMT/UTC
Deaths: Total number of deaths in a country
Deaths (today): Deaths in 24 hours GMT/UTC
Recovered: Total number of recovered people
Active: Total number of active patients
Critical: Total number of critical patients
Per Million: Affected patients per million
Coronavirus Stats
Also Read: 14 Useful APT CACHE Examples on Ubuntu 18.04
Prerequisites
a)First you require a running RedHat/CentOS 7
machine.
b)You need to have npm
installed on that node. Please check Install NPM and Node.js in 6 Easy Steps on CentOS 7 to know more about the npm
installation steps.
b)You should have sudo
access to run privilege commands. Please check Step by Step: How to Add User to Sudoers on Ubuntu 18.04 to know more about providing sudo
access to User.
Install Corona-Cli
You can install corona-cli
package by running npm install -g corona-cli
command as shown below. This command will install the Corona-cli
package along with other necessary required packages.
[root@localhost ~]# npm install -g corona-cli /usr/bin/corona -> /usr/lib/node_modules/corona-cli/index.js /usr/bin/corona-cli -> /usr/lib/node_modules/corona-cli/index.js + corona-cli@3.8.6 added 190 packages from 91 contributors in 14.377s ╭────────────────────────────────────────────────────────────────╮ │ │ │ New minor version of npm available! 6.13.6 → 6.14.4 │ │ Changelog: https://github.com/npm/cli/releases/tag/v6.14.4 │ │ Run npm install -g npm to update! │ │ │ ╰────────────────────────────────────────────────────────────────╯
NOTE:
corona-cli
package installation then it would be recommended to update your npm
tool first by running npm install -g npm
command then try to run the corona-cli
installation again.Example 1: Check Coronavirus Stats Sorted by Number of Cases
If you want to Coronavirus stats of all the countries sorted by the number of cases, then by default corona
command will show you the output as shown below. So the country having highest number of cases will show on top and then the second highest and so on.
[root@localhost ~]# corona corona-cli v3.8.6 by Awais.dev Track the Coronavirus disease (COVID-19). ℹ Sorted by: cases ┌─────┬────────────────────────┬─────────┬───────────────┬────────┬────────────────┬───────────┬─────────┬──────────┬─────────────┐ │ # │ Country │ Cases │ Cases (today) │ Deaths │ Deaths (today) │ Recovered │ Active │ Critical │ Per Million │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ — │ Worldwide │ 842,201 │ — │ 41,405 │ — │ 176,504 │ — │ — │ — │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 1 │ USA │ 180,636 │ 16,848 │ 3,575 │ 434 │ 6,241 │ 170,820 │ 3,981 │ 546 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 2 │ Italy │ 105,792 │ 4,053 │ 12,428 │ 837 │ 15,729 │ 77,635 │ 4,023 │ 1,750 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 3 │ Spain │ 94,417 │ 6,461 │ 8,269 │ 553 │ 19,259 │ 66,889 │ 5,607 │ 2,019 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 4 │ China │ 81,518 │ 79 │ 3,305 │ 5 │ 76,052 │ 2,161 │ 528 │ 57 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 5 │ Germany │ 68,180 │ 1,295 │ 682 │ 37 │ 15,824 │ 51,674 │ 1,979 │ 814 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 6 │ France │ 52,128 │ 7,578 │ 3,523 │ 499 │ 9,444 │ 39,161 │ 5,565 │ 799 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 7 │ Iran │ 44,605 │ 3,110 │ 2,898 │ 141 │ 14,656 │ 27,051 │ 3,703 │ 531 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤
Example 2: Check Coronavirus Stats of USA
If you want to check the stats of a Country then you need to pass the country name as an argument with the corona
command as shown below. In this example, we are trying to check the Coronavirus stats in USA.
[root@localhost ~]# corona US corona-cli v3.8.6 by Awais.dev Track the Coronavirus disease (COVID-19). ┌───┬───────────┬─────────┬───────────────┬────────┬────────────────┬───────────┬─────────┬──────────┬─────────────┐ │ # │ Country │ Cases │ Cases (today) │ Deaths │ Deaths (today) │ Recovered │ Active │ Critical │ Per Million │ ├───┼───────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ — │ Worldwide │ 846,146 │ — │ 41,475 │ — │ 176,520 │ — │ — │ — │ ├───┼───────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ — │ USA │ 180,789 │ 17,001 │ 3,580 │ 439 │ 6,241 │ 170,968 │ 3,981 │ 546 │ └───┴───────────┴─────────┴───────────────┴────────┴────────────────┴───────────┴─────────┴──────────┴─────────────┘ ℹ Last Updated: Tue Mar 31 2020 06:28:26 GMT-0500 (GMT-05:00)
Example 3: Check USA States Coronavirus Stats
If you want to check the Coronavirus stats of each and every states of USA then you need to use corona states
command as shown below.
[root@localhost ~]# corona states corona-cli v3.8.6 by Awais.dev Track the Coronavirus disease (COVID-19). ℹ Sorted by: cases ┌────┬──────────────────────────────┬────────┬───────────────┬────────┬────────────────┬────────┐ │ # │ State │ Cases │ Cases (today) │ Deaths │ Deaths (today) │ Active │ ├────┼──────────────────────────────┼────────┼───────────────┼────────┼────────────────┼────────┤ │ 1 │ New York │ 75,795 │ 8,470 │ 1,550 │ 208 │ 69,270 │ ├────┼──────────────────────────────┼────────┼───────────────┼────────┼────────────────┼────────┤ │ 2 │ New Jersey │ 18,696 │ 2,060 │ 267 │ 69 │ 18,429 │ ├────┼──────────────────────────────┼────────┼───────────────┼────────┼────────────────┼────────┤ │ 3 │ Michigan │ 7,615 │ 1,117 │ 259 │ 75 │ 7,351 │ ├────┼──────────────────────────────┼────────┼───────────────┼────────┼────────────────┼────────┤ │ 4 │ California │ 7,453 │ 205 │ 149 │ 4 │ 7,244 │ ├────┼──────────────────────────────┼────────┼───────────────┼────────┼────────────────┼────────┤ │ 5 │ Massachusetts │ 6,620 │ 868 │ 89 │ 33 │ 6,521 │ ├────┼──────────────────────────────┼────────┼───────────────┼────────┼────────────────┼────────┤ │ 6 │ Florida │ 6,338 │ 634 │ 77 │ 6 │ 6,261 │ ├────┼──────────────────────────────┼────────┼───────────────┼────────┼────────────────┼────────┤ │ 7 │ Illinois │ 5,994 │ 937 │ 99 │ 26 │ 5,893 │
Example 4: Sort Coronavirus Stats By Critical Category
Instead of sorting the Coronavirus stats by the number of cases, you can sort it by Critical Category by running corona -s critical
command as shown in below example. So the country with the highest number of critical cases will show on top and then country with second highest number of Critical cases and so on.
[root@localhost ~]# corona -s critical corona-cli v3.8.6 by Awais.dev Track the Coronavirus disease (COVID-19). ℹ Sorted by: critical ┌─────┬────────────────────────┬─────────┬───────────────┬────────┬────────────────┬───────────┬─────────┬──────────┬─────────────┐ │ # │ Country │ Cases │ Cases (today) │ Deaths │ Deaths (today) │ Recovered │ Active │ Critical │ Per Million │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ — │ Worldwide │ 854,039 │ — │ 42,014 │ — │ 176,906 │ — │ — │ — │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 1 │ Spain │ 95,923 │ 7,967 │ 8,464 │ 748 │ 19,259 │ 68,200 │ 5,607 │ 2,052 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 2 │ France │ 52,128 │ 7,578 │ 3,523 │ 499 │ 9,444 │ 39,161 │ 5,565 │ 799 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 3 │ Italy │ 105,792 │ 4,053 │ 12,428 │ 837 │ 15,729 │ 77,635 │ 4,023 │ 1,750 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 4 │ USA │ 185,270 │ 21,482 │ 3,780 │ 639 │ 6,347 │ 175,143 │ 3,981 │ 560 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 5 │ Iran │ 44,605 │ 3,110 │ 2,898 │ 141 │ 14,656 │ 27,051 │ 3,703 │ 531 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 6 │ Germany │ 71,690 │ 4,805 │ 774 │ 129 │ 16,100 │ 54,816 │ 2,675 │ 856 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 7 │ Netherlands │ 12,595 │ 845 │ 1,039 │ 175 │ 250 │ 11,306 │ 1,053 │ 735 │
Example 5: Filter a Country Coronavirus Stats from Critical Category
If you want to know the Coronavirus stats of a specific country instead of getting a list of all Critical Sorted Category then you can use sed
command to extract the information of that specific country only by running below command. Here we are using 6p
to display 6th line from corona -s critical
output along with the line which contains keyword china
.
[root@localhost ~]# corona -s critical | sed -n '6p;/China/p' ℹ Sorted by: critical │ # │ Country │ Cases │ Cases (today) │ Deaths │ Deaths (today) │ Recovered │ Active │ Critical │ Per Million │ │ 10 │ China │ 81,518 │ 0 │ 3,305 │ 0 │ 76,052 │ 2,161 │ 528 │ 57 │
Example 6: Sort Coronavirus Stats by Recovered Category
If you want to sort the Country Coronavirus stats by Recovered Category then you need to use corona -s recovered
command as shown below. So country with highest number of recovered cases will shown on the top and then the country with second highest number of recovered case will show on second and so on.
[root@localhost ~]# corona -s recovered corona-cli v3.8.6 by Awais.dev Track the Coronavirus disease (COVID-19). ℹ Sorted by: recovered ┌─────┬────────────────────────┬─────────┬───────────────┬────────┬────────────────┬───────────┬─────────┬──────────┬─────────────┐ │ # │ Country │ Cases │ Cases (today) │ Deaths │ Deaths (today) │ Recovered │ Active │ Critical │ Per Million │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ — │ Worldwide │ 854,608 │ — │ 42,043 │ — │ 176,908 │ — │ — │ — │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 1 │ China │ 81,518 │ 0 │ 3,305 │ 0 │ 76,052 │ 2,161 │ 528 │ 57 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 2 │ Spain │ 95,923 │ 7,967 │ 8,464 │ 748 │ 19,259 │ 68,200 │ 5,607 │ 2,052 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 3 │ Germany │ 71,808 │ 4,923 │ 775 │ 130 │ 16,100 │ 54,933 │ 2,675 │ 857 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 4 │ Italy │ 105,792 │ 4,053 │ 12,428 │ 837 │ 15,729 │ 77,635 │ 4,023 │ 1,750 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 5 │ Iran │ 44,605 │ 3,110 │ 2,898 │ 141 │ 14,656 │ 27,051 │ 3,703 │ 531 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤
Example 7: Sort Coronavirus Stats by Number of Deaths
If you want to sort the Countries Coronavirus stats by number of deaths then you can use corona -s deaths
command as shown below. Similarly, like above here also country with highest number of deaths will show at the top and then country with second highest number of deaths and so on.
[root@localhost ~]# corona -s deaths corona-cli v3.8.6 by Awais.dev Track the Coronavirus disease (COVID-19). ℹ Sorted by: deaths ┌─────┬────────────────────────┬─────────┬───────────────┬────────┬────────────────┬───────────┬─────────┬──────────┬─────────────┐ │ # │ Country │ Cases │ Cases (today) │ Deaths │ Deaths (today) │ Recovered │ Active │ Critical │ Per Million │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ — │ Worldwide │ 854,608 │ — │ 42,043 │ — │ 176,908 │ — │ — │ — │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 1 │ Italy │ 105,792 │ 4,053 │ 12,428 │ 837 │ 15,729 │ 77,635 │ 4,023 │ 1,750 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 2 │ Spain │ 95,923 │ 7,967 │ 8,464 │ 748 │ 19,259 │ 68,200 │ 5,607 │ 2,052 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 3 │ USA │ 186,046 │ 22,258 │ 3,807 │ 666 │ 6,347 │ 175,892 │ 3,981 │ 562 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 4 │ France │ 52,128 │ 7,578 │ 3,523 │ 499 │ 9,444 │ 39,161 │ 5,565 │ 799 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 5 │ China │ 81,518 │ 0 │ 3,305 │ 0 │ 76,052 │ 2,161 │ 528 │ 57 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤
Example 8: Display only top 5 Countries with highest Number of Deaths
Sometimes you might want to check only top 5 countries with highest number of deaths. So if you want to check only top 5 countries details having highest number of deaths then you need to use corona -s death --limit 5
command as shown below.
[root@localhost ~]# corona -s death --limit 5 corona-cli v3.8.6 by Awais.dev Track the Coronavirus disease (COVID-19). ℹ Sorted by: death ┌───┬───────────┬─────────┬───────────────┬────────┬────────────────┬───────────┬─────────┬──────────┬─────────────┐ │ # │ Country │ Cases │ Cases (today) │ Deaths │ Deaths (today) │ Recovered │ Active │ Critical │ Per Million │ ├───┼───────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ — │ Worldwide │ 872,972 │ — │ 43,275 │ — │ 184,594 │ — │ — │ — │ ├───┼───────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 1 │ USA │ 188,639 │ 109 │ 4,059 │ 6 │ 7,251 │ 177,329 │ 4,576 │ 570 │ ├───┼───────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 2 │ Italy │ 105,792 │ 0 │ 12,428 │ 0 │ 15,729 │ 77,635 │ 4,023 │ 1,750 │ ├───┼───────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 3 │ Spain │ 102,136 │ 6,213 │ 9,053 │ 589 │ 22,647 │ 70,436 │ 5,872 │ 2,185 │ ├───┼───────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 4 │ Germany │ 72,383 │ 575 │ 788 │ 13 │ 16,100 │ 55,495 │ 2,675 │ 864 │ ├───┼───────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 5 │ France │ 52,128 │ 0 │ 3,523 │ 0 │ 9,444 │ 39,161 │ 5,565 │ 799 │ └───┴───────────┴─────────┴───────────────┴────────┴────────────────┴───────────┴─────────┴──────────┴─────────────┘ ℹ Last Updated: Tue Mar 31 2020 18:02:13 GMT-0500 (GMT-05:00)
Example 9: Display Active Coronavirus Stats in Reverse Order
If you want to check active coronavirus stats in reverse order then you need to use corona --sort active --reverse
command as shown below.
[root@localhost ~]# corona --sort active --reverse corona-cli v3.8.6 by Awais.dev Track the Coronavirus disease (COVID-19). ℹ Sorted by: active & Order: reversed ┌─────┬────────────────────────┬─────────┬───────────────┬────────┬────────────────┬───────────┬─────────┬──────────┬─────────────┐ │ # │ Country │ Cases │ Cases (today) │ Deaths │ Deaths (today) │ Recovered │ Active │ Critical │ Per Million │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ — │ Worldwide │ 872,972 │ — │ 43,275 │ — │ 184,594 │ — │ — │ — │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 1 │ St. Vincent Grenadines │ 1 │ 0 │ 0 │ 0 │ 1 │ 0 │ 0 │ 9 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 2 │ Papua New Guinea │ 1 │ 0 │ 0 │ 0 │ 0 │ 1 │ 0 │ 0.1 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 3 │ Sierra Leone │ 1 │ 0 │ 0 │ 0 │ 0 │ 1 │ 0 │ 0.1 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 4 │ Timor-Leste │ 1 │ 0 │ 0 │ 0 │ 0 │ 1 │ 0 │ 0.8 │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤ │ 5 │ MS Zaandam │ 2 │ 0 │ 0 │ 0 │ 0 │ 2 │ 0 │ │ ├─────┼────────────────────────┼─────────┼───────────────┼────────┼────────────────┼───────────┼─────────┼──────────┼─────────────┤
Example 10: Check Other Options with –help
You can check all the other options that can be used with corona command using --help
option.
[root@localhost ~]# corona --help Track the Coronavirus disease (COVID-19). Usage corona[--option] Commands country-name Get data for a given country states Get data for all USA states Options --xcolor, -x Single colored output --sort, -s Sort data by type --reverse, -r Reverse print order --limit, -l Print only N entries Examples corona china corona states corona -x corona --sort cases-today corona -s critical ❯ You can also run command + option at once: corona china -x -s cases
Also Read: Popular Known Facts About Coronavirus(Covid-19)
Reference: GitHub Corona-Cli