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 12
Level 12
Posts: 4082
Joined: Sun Nov 21, 2010 8:31 pm
Location: Youngstown, Ohio

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.
If you want the things you've never had,
You have to do things you've never done.

coonhunter
Level 1
Level 1
Posts: 8
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 12
Level 12
Posts: 4082
Joined: Sun Nov 21, 2010 8:31 pm
Location: Youngstown, Ohio

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.
If you want the things you've never had,
You have to do things you've never done.


Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 3 guests