LinuxQuestions.org
Visit Jeremy's Blog.
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 02-04-2015, 05:46 AM   #1
skoda
Member
 
Registered: Jun 2013
Posts: 111

Rep: Reputation: Disabled
Clear screen after every netstat update


Hi folks,

When i past this on the shell, the command rungs, but it does not clear previous data on each update.

Quote:
@echo off
:GoAgain
clear
netstat -atnp -w 5 | grep ESTA
goto GoAgain
what could be wrong?
 
Old 02-04-2015, 07:12 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,380

Rep: Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650
Since this appears to be a windows batch file the correct syntax for clearing the screen is cls not clear.
 
Old 02-04-2015, 07:19 AM   #3
skoda
Member
 
Registered: Jun 2013
Posts: 111

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
Since this appears to be a windows batch file the correct syntax for clearing the screen is cls not clear.
Hi michelk,

nop, problem remain same

Quote:
@echo off
:GoAgain
cls
netstat -atnp -w 5 | grep ESTA
goto GoAgain
 
Old 02-04-2015, 07:32 AM   #4
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Is this a shell script in linux?

Then goto command doesn't works.

So you have to put 'clear' command after netstat command.

Also for looping you would use the keywords 'while' or 'until'.

Last edited by veerain; 02-04-2015 at 08:29 AM.
 
Old 02-04-2015, 07:32 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,380

Rep: Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650Reputation: 1650
Then please explain your environment i.e is this just a command window etc.
 
Old 02-04-2015, 10:46 PM   #6
skoda
Member
 
Registered: Jun 2013
Posts: 111

Original Poster
Rep: Reputation: Disabled
Thanks folks,
this is centos 6.x shell.

ill take a look at while and until functions.
 
Old 02-05-2015, 05:16 AM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,294

Rep: Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358
Here's a good cli tutorial http://rute.2038bug.com/index.html.gz
 
Old 02-08-2015, 08:30 PM   #8
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: Red Hat (8.0, RHEL5,6), CentOS, SuSE (10.x, 11.x, 12.2, 13.2), Solaris (8-10), Tru64, MacOS, Raspian
Posts: 1,124

Rep: Reputation: 65
Quote:
Originally Posted by veerain View Post
Is this a shell script in linux?
Agreed. I think I'm having a flashback to my DOS batch file days.
 
  


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
vim doesn't clear screen inside of screen eddified Linux - Software 4 01-04-2010 10:44 AM
how do i replace the clear "clear screen" with the cls command thefedexguy SUSE / openSUSE 2 12-02-2005 05:02 PM
how to clear screen in C ? indian Programming 3 10-01-2004 10:58 PM
Clear the Screen in C++ OrganicX Programming 16 07-23-2003 04:07 PM
How to clear screen? alexzander Programming 1 01-23-2003 08:43 PM


All times are GMT -5. The time now is 08:01 PM.

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