The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 10:10 AM
how to display line number for tail -f iengca UNIX for Dummies Questions & Answers 4 12-13-2007 08:46 AM
MatLab alike software in Fedora MULTIVERSE Ubuntu 1 09-14-2007 09:22 AM
Display Directory Size - DF? t4st33@mac.com UNIX for Dummies Questions & Answers 3 01-11-2007 02:12 AM
Constantly updating log files (tail -f? grep? awk?) nortonloaf UNIX for Dummies Questions & Answers 0 12-03-2006 11:20 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-21-2002
rschelkers rschelkers is offline
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.
  #2 (permalink)  
Old 03-21-2002
PxT's Avatar
PxT PxT is offline Forum Advisor  
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.
  #3 (permalink)  
Old 03-21-2002
rschelkers rschelkers is offline
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!
  #4 (permalink)  
Old 03-21-2002
PxT's Avatar
PxT PxT is offline Forum Advisor  
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.
  #5 (permalink)  
Old 03-22-2002
rschelkers rschelkers is offline
Registered User
  
 

Join Date: Mar 2002
Posts: 3
Thumbs up

This works great!
Thanks a lot!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0