The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
tail display ....in perl zedex Shell Programming and Scripting 2 01-15-2008 07:10 AM
how to display line number for tail -f iengca UNIX for Dummies Questions & Answers 4 12-13-2007 05:46 AM
MatLab alike software in Fedora MULTIVERSE Linux 1 09-14-2007 05:22 AM
Display Directory Size - DF? t4st33@mac.com UNIX for Dummies Questions & Answers 3 01-10-2007 11:12 PM
Constantly updating log files (tail -f? grep? awk?) nortonloaf UNIX for Dummies Questions & Answers 0 12-03-2006 08:20 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 03-21-2002
Registered User
 

Join Date: Mar 2002
Posts: 3
Unhappy Tail-alike display of new files in directory

The system I work on, produces several kinds of status-files in a single directory. I would like to be able to see the files as they are added to this directory.

I was wondering if it would be possible to get a "tail -f" alike view of the ls-command, in such a way that a newly added file is automagically added at the bottom.

The way we do it now, is with the command below, which we need to execute manually (which imho is not handy):

ls -l -rt|tail -20 (to view 20 last files)

And we do more "in depth" searches inside these files with:

ls -l -rt tail `grep -l searchstring *`

But it would be wonderful to just see the list "grow" since this way, it is much easier to recognize errormessages since these errormessages are fixed size, 645 bytes and easy to spot.

We use SunOS 5.7 with Bash 2.01.
Reply With Quote
Forum Sponsor
  #2  
Old 03-21-2002
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
Linux provides a utility called "watch" which you could use to do this. Something like:

watch "ls -lrt | tail -5"

would give you a constantly updated list of the 5 most recently updated files. Unfortunately, I dont think this utility is included with Solaris. It is part of the procps package on Linux. You could try downloading it (http://procps.sourceforge.net/) and compiling for your architecture.
Reply With Quote
  #3  
Old 03-21-2002
Registered User
 

Join Date: Mar 2002
Posts: 3
I do remember watch now! Have not used it in quite some time. I run mostly FreeBSD, OpenBSD and Solaris nowadays and didn't even miss it (until now!)...
Quote:
I dont think this utility is included with Solaris.
I just checked, you're right, it's not included.
Quote:
You could try downloading it (http://procps.sourceforge.net/) and compiling for your architecture.
Even though I am root on this machine, I am not allowed to install any software on it. This is a mission critical system (almost the entire carbranche in The Netherlands would collapse if anything happened to it!).
Getting permission to install additional software on it would require a lot of people to agree with it and I don't think that will happen in the near future.

Thanks for the reply!
Reply With Quote
  #4  
Old 03-21-2002
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
A simple shell script alternative would be something like:

Code:
#!/bin/sh
while (true)
do
     ls -lrt | tail -5
     sleep 5
     clear
done
Unfortunately the output can getting annoying as it clears the screen every time. "watch" does not suffer the same problem.
Reply With Quote
  #5  
Old 03-22-2002
Registered User
 

Join Date: Mar 2002
Posts: 3
Thumbs up

This works great!
Thanks a lot!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:46 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0