BASH Script:displays total download usage in specified time

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
User avatar
Habitual
Level 13
Level 13
Posts: 4804
Joined: Sun Nov 21, 2010 8:31 pm

Re: BASH Script:displays total download usage in specified t

Postby Habitual » Sun Aug 05, 2012 8:15 am

This sums up net usage quite nicely by the hour...

Code: Select all

#!/bin/bash
echo "Tx (MiB) for this hour is" $(for i in `date +%H` ; do vnstat --dumpdb | \grep "h;$i" ; done | cut -c 17- | cut -d\; -f1)
echo "Rx (MiB) for this hour is" $(for i in `date +%H` ; do vnstat --dumpdb | \grep "h;$i" ; done | cut -c 17- | cut -d\; -f2)


You'll need to install something to make that work, I will leave that up to you to figure out.
Image
rkhunter 1.4.3 Tutorial
“The single biggest problem in communication is the illusion that it has taken place.”

coonhunter
Level 1
Level 1
Posts: 10
Joined: Thu Aug 25, 2011 4:26 pm

Re: BASH Script:displays total download usage in specified t

Postby coonhunter » Sun Aug 05, 2012 8:49 am

Habitual wrote:This sums up net usage quite nicely by the hour...

Code: Select all

#!/bin/bash
echo "Tx (MiB) for this hour is" $(for i in `date +%H` ; do vnstat --dumpdb | \grep "h;$i" ; done | cut -c 17- | cut -d\; -f1)
echo "Rx (MiB) for this hour is" $(for i in `date +%H` ; do vnstat --dumpdb | \grep "h;$i" ; done | cut -c 17- | cut -d\; -f2)


You'll need to install something to make that work, I will leave that up to you to figure out.
Last edited by coonhunter on Sun Aug 12, 2012 5:12 pm, edited 1 time in total.

User avatar
Habitual
Level 13
Level 13
Posts: 4804
Joined: Sun Nov 21, 2010 8:31 pm

Re: BASH Script:displays total download usage in specified t

Postby Habitual » Sun Aug 05, 2012 8:55 am

Habitual wrote:...I will leave that up to you to figure out.
Image
rkhunter 1.4.3 Tutorial
“The single biggest problem in communication is the illusion that it has taken place.”


Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 4 guests