Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6785493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:08:00+00:00 2026-05-26T17:08:00+00:00

I am trying to write in BASH my own tracking such as shown in

  • 0

I am trying to write in BASH my own tracking such as shown in the attachment.

enter image description here

Specially i need to track the Network History Recieving and Sending data. Where i can get those Network send/receive values, is it in a file or is that comes out from some commands in Linux?

Using BASH i am trying to implement something similar as below:

ex:

/* My 10 seconds timer */ 
t = new javax.swing.Timer(10000, new ActionListener() 
{
    public void actionPerformed(ActionEvent ae) 
    {
    }
}); 

Follow up: (good site: http://www.debianhelp.co.uk/networktools1.htm)

$ sudo apt-get install bwm-ng; 
yum -y install bwm; 

# Show me only plain mode 
$ bwm-ng -o plain

 bwm-ng v0.6 (delay 0.500s); press 'ctrl-c' to end this
 /proc/net/dev
 |         iface                    Rx                   Tx               Total
 ==============================================================================
              lo:       88803.53 KB/s        88803.53 KB/s        88803.53 KB/s
            eth0:           0.13 KB/s            0.13 KB/s            0.13 KB/s
 ------------------------------------------------------------------------------
           total:       88803.66 KB/s        88803.66 KB/s        88803.66 KB/s

# Show only the interface that i need to see
$ bwm-ng -o plain -I eth0

bwm-ng v0.6 (delay 0.500s); press 'ctrl-c' to end this
 /proc/net/dev
 |         iface                    Rx                   Tx               Total
 ==============================================================================
            eth0:           0.13 KB/s            0.13 KB/s            0.13 KB/s
 ------------------------------------------------------------------------------
           total:           0.13 KB/s            0.13 KB/s            0.13 KB/s

# Show only in MB format or KB format
# by skiping -d will default show as KB
$ bwm-ng -o plain -d

bwm-ng v0.6 (delay 0.500s); press 'ctrl-c' to end this
 /proc/net/dev
 /         iface                    Rx                   Tx               Total
 ==============================================================================
              lo:          85.79 MB/s           85.79 MB/s           85.79 MB/s
            eth0:         246.58  B/s          246.58  B/s          246.58  B/s
 ------------------------------------------------------------------------------
           total:          85.79 MB/s           85.79 MB/s           85.79 MB/s

 $ bwm-ng -o plain -N -d | grep total:
      total:           0.00  B/s            0.00  B/s            0.00  B/s
      total:           1.28 MB/s            1.28 MB/s            1.28 MB/s
      total:           1.19 MB/s            1.19 MB/s            1.19 MB/s
      total:           1.19 MB/s            1.19 MB/s            1.19 MB/s


 # another tool i used apt-get install vnstat
 # bwm-ng was doing wrong strange on other interfaces but this one 
 # now showing correct
 $ vnstat -u -i lo 
 $ vnstat -u -i eth0
 $ vnstat 
 $ iftop -i eth0
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:08:00+00:00Added an answer on May 26, 2026 at 5:08 pm

    EDIT: the easy way: you could always use mrtg or cacti instead of doing it yourself.

    otherwise…
    getting the bytes in and the bytes out, each 2 seconds (hit ctrl+c to make it stop):

    default_device=$(awk ' { if ($2 == '00000000') print $1 ; } ' < /proc/net/route)
    while true
    do
        bytesin=$(grep $default_device /proc/net/dev | cut -d':' -f2 | awk ' { print $1; } ')
        bytesout=$(grep $default_device /proc/net/dev | cut -d':' -f2 | awk ' { print $9; } ')
        echo bytesin=$bytesin bytesout=$bytesout
        sleep 2
    done
    

    you’ll get output like this:

    bytesin=622734605 bytesout=1249429296
    bytesin=622735091 bytesout=1249429620
    bytesin=622735523 bytesout=1249430120
    bytesin=622736268 bytesout=1249430481
    bytesin=622736874 bytesout=1249430535
    

    the values are obtained for the device where the default route is installed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a bash script that will process a list of files
I am trying to write a bash or PHP script that will execute a
I'm trying to write a bash script that wraps whatever the user wants to
Im trying to write a bash script that executes several commands as different users
I'm trying to write a bash script that will download all of the youtube
I'm trying to write a bash script that can edit itself. The line of
I'm trying to write a bash script that will let me download multiple web
I am trying to write a bash script to automatically mount a volume that
I am trying to write a simple bash script that will search for files
I'm trying to write a simple bash script that accepts all arguments and interprets

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.