Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    screen - tail box


    From a shell script I would like to display the output of tail -f. While doing this, I want to restrict the output to the last 15lines of my screen only (and allow it to overwrite itself).

    I thought of using curses to define my own window - however initscr() call wipes out the entire screen first.

    The 'screen' utility looks promising, I can split the screen using Ctr+a S. However how do I do this programmatically while invoking screen itself?

    I would like to invoke my main shell script as well as this 'tail box' (if I can call it that, without offending 'dialog' users)....

    Any help is greatly appreciated!

  2. #2
    Linux Newbie theNbomr's Avatar
    Join Date
    May 2007
    BC Canada
    How about something like
    xterm -geometry 80x15 -e 'tail -f /var/log/yourfile'
    --- rod.
    Stuff happens. Then stays happened.

  3. #3
    Linux Engineer
    Join Date
    Jan 2005
    Saint Paul, MN
    Quote Originally Posted by theNbomr View Post
    How about something like
    xterm -geometry 80x15 -e 'tail -f /var/log/yourfile'
    --- rod.
    The quotes on the command should not be there. The remainder of the command line after the "-e" is the command and the quotes turns the whole command into a single field. Also this solution does not restrict the output only to 15 lines as the scroll buffer is not set to 15 lines. The correct solution would be:
    xterm -geometry 80x15 -sl 15 -e tail -f /var/log/messages &
    The "-sl 15" sets the scroll buffer to 15 lines. For those not understanding the "-geometry 80x15" defines a window having 15 rows of 80 characters per row. Before KDE and Gnome, text based applications used the width and height in characters rather than in screen real estate sizes which was very nice and xterm is one of the oldest X applications.

    Other geometry options include placement information:
    -geometry widthXheight+xoffset+yoffest
    Note that the "+" can be a "-" for from bottom or right edges rather than from the top and left edges.

    Also note that KDE and Gnome still have this options (which is slightly modified do that all applications use screen real estate width and heights and the format is changed.
    --geometry widthxheigh+x+y

    Also note in all cases the +x+y can be used without the widthxheight portion.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts