LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-25-2011, 01:39 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 36
Problem adjusting the output


Hi i m running a command
Code:
watch -n 1 -d netstat -i
to see the packet drops every 1 second.
but the problem is the output is so long(Due to large number of virtual interfaces) it doesn't fit into the putty prompt.

I dont need to monitor each and every network interface I m more interested in monitoring the interfaces starting from vif but whenever i run following command it doesnt display anything.
Code:
watch -n 3 -d netstat -i | grep vif*
What should i do?
 
Old 05-25-2011, 01:55 AM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
@ Reply

Remove grep from the command and it will work:

watch -n 3 -d netstat -i eth0
 
Old 05-25-2011, 02:02 AM   #3
lonesoac0
Member
 
Registered: Jan 2010
Distribution: Ubuntu
Posts: 94

Rep: Reputation: 4
I think that you need to include vif* next to netstat. I would try something like: watch -n 3 -d 'netstat -i vif*' I looked up the man of watch (http://linux.die.net/man/1/watch) and in the examples it states: "watch -d 'ls -l | fgrep joe'" the LS is of particular interest because it is a command. So, I am willing to bet you can do it if you place your netstat command in ''.
 
Old 05-25-2011, 02:18 AM   #4
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by lonesoac0 View Post
I think that you need to include vif* next to netstat. I would try something like: watch -n 3 -d 'netstat -i vif*' I looked up the man of watch (http://linux.die.net/man/1/watch) and in the examples it states: "watch -d 'ls -l | fgrep joe'" the LS is of particular interest because it is a command. So, I am willing to bet you can do it if you place your netstat command in ''.
The above command is not working as you dont have any option specifying interface name with -i option.
Code:
# netstat -i vif*
usage: netstat [-veenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help}
       netstat [-vnNcaeol] [<Socket> ...]
       netstat { [-veenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s } [delay]

        -r, --route                display routing table
        -I, --interfaces=[<Iface>] display interface table for <Iface>
        -i, --interfaces           display interface table
        -g, --groups               display multicast group memberships
        -s, --statistics           display networking statistics (like SNMP)
        -M, --masquerade           display masqueraded connections

        -v, --verbose              be verbose
        -n, --numeric              don't resolve names
        --numeric-hosts            don't resolve host names
        --numeric-ports            don't resolve port names
        --numeric-users            don't resolve user names
        -N, --symbolic             resolve hardware names
        -e, --extend               display other/more information
        -p, --programs             display PID/Program name for sockets
        -c, --continuous           continuous listing

        -l, --listening            display listening server sockets
        -a, --all, --listening     display all sockets (default: connected)
        -o, --timers               display timers
        -F, --fib                  display Forwarding Information Base (default)
        -C, --cache                display routing cache instead of FIB
        -T, --notrim               stop trimming long addresses
        -Z, --context              display SELinux security context for sockets

  <Iface>: Name of interface to monitor/list.
  <Socket>={-t|--tcp} {-u|--udp} {-S|--sctp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom
  <AF>=Use '-A <af>' or '--<af>'; default: inet
  List of possible address families (which support routing):
    inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)
    netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)
    x25 (CCITT X.25)
 
Old 05-25-2011, 02:22 AM   #5
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
@ Reply

Did you try:

watch -n 3 -d netstat -i eth*

it worked for me... check my previous post.
 
Old 05-25-2011, 02:23 AM   #6
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by T3RM1NVT0R View Post
Remove grep from the command and it will work:

watch -n 3 -d netstat -i eth0
not valid command.
Code:
# netstat -i eth0
usage: netstat [-veenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help}
       netstat [-vnNcaeol] [<Socket> ...]
       netstat { [-veenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s } [delay]

        -r, --route                display routing table
        -I, --interfaces=[<Iface>] display interface table for <Iface>
        -i, --interfaces           display interface table
        -g, --groups               display multicast group memberships
        -s, --statistics           display networking statistics (like SNMP)
        -M, --masquerade           display masqueraded connections

        -v, --verbose              be verbose
        -n, --numeric              don't resolve names
        --numeric-hosts            don't resolve host names
        --numeric-ports            don't resolve port names
        --numeric-users            don't resolve user names
        -N, --symbolic             resolve hardware names
        -e, --extend               display other/more information
        -p, --programs             display PID/Program name for sockets
        -c, --continuous           continuous listing

        -l, --listening            display listening server sockets
        -a, --all, --listening     display all sockets (default: connected)
        -o, --timers               display timers
        -F, --fib                  display Forwarding Information Base (default)
        -C, --cache                display routing cache instead of FIB
        -T, --notrim               stop trimming long addresses
        -Z, --context              display SELinux security context for sockets

  <Iface>: Name of interface to monitor/list.
  <Socket>={-t|--tcp} {-u|--udp} {-S|--sctp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom
  <AF>=Use '-A <af>' or '--<af>'; default: inet
  List of possible address families (which support routing):
    inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)
    netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)
    x25 (CCITT X.25)
 
Old 05-25-2011, 06:23 AM   #7
lonesoac0
Member
 
Registered: Jan 2010
Distribution: Ubuntu
Posts: 94

Rep: Reputation: 4
I just tried: watch -n 3 -d netstat -i eth* on Debian squeeze and it worked fine. You could try which watch and which netstat. The which command shows the exact location of the executable. You could try: /PATHWAY/TO/WATCH -n 3 -d /PATHWAY/TO/NETSTAT -i eth[0-9] The [0-9] parameter looks for the interfaces 0 through 9.
 
Old 05-26-2011, 12:06 AM   #8
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by lonesoac0 View Post
I just tried: watch -n 3 -d netstat -i eth* on Debian squeeze and it worked fine. You could try which watch and which netstat. The which command shows the exact location of the executable. You could try: /PATHWAY/TO/WATCH -n 3 -d /PATHWAY/TO/NETSTAT -i eth[0-9] The [0-9] parameter looks for the interfaces 0 through 9.
Code:
watch -n 1 -d "netstat -i | grep vif*"
This has worked for me i needed to put the command in ".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Adjusting the Toolchain Alex83 Linux From Scratch 4 10-07-2010 01:01 PM
No output from sanity check, chapter 5.7.*Adjusting the Toolchain Murdock_nl Linux From Scratch 2 09-13-2008 01:59 AM
5.7 Adjusting the Toolchain Problem g3neration Linux From Scratch 2 09-08-2007 11:41 AM
wireless adjusting problem dreamhunter Linux - Wireless Networking 1 11-25-2005 09:09 AM
Adjusting sound output device DanielTan Linux - Laptop and Netbook 3 10-19-2005 02:35 PM


All times are GMT -5. The time now is 04:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration