[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Netstat script?



Rus Foster wrote:

On Sun, 20 Feb 2005, SigmaX wrote:

I know nothing about scripting, but I want to write/obtain a script that displays the results of the command "netstat -a | grep tcp", then clears the screen and does so again a few seconds later. Else I just need a program that does something similar in the console, so I can view it over SSH.

A very simple one for this

#!/bin/bash

while [ 1 ] ; do

  netstat -a | grep tcp
  sleep 1 # This is number of seconds
  clear

done

That should do what you want on a very basic level

Rus
Thanx all for the examples! Took some tweaking and googling (Which I should have done in the first place), I assume because I forgot when posting this was on my FreeBSD box, not my Debian box(es). Anyway, it was a little different, but I got it working now!
         Thanx again,
             SigmaX

--
Registered Linux Freak #: 366,862

"If you think of MS-DOS as mono, and Windows as stereo, then Linux is Dolby Pro-Logic Surround Sound with Bass Boost and all the music is free."



Reply to: