Find the answer to your Linux question:
Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By kurtdriver
Is there a command to show one page of text? I want something like less or more, but automatically quits after displaying a single page....
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2013
    Posts
    2

    Show a Single Page and then Quit


    Is there a command to show one page of text? I want something like less or more, but automatically quits after displaying a single page.

  2. #2
    Just Joined!
    Join Date
    May 2009
    Posts
    1
    You could use cat with the file name then pipe head or tail with a -n and the number of lines to display. example cat /etc/hosts.deny | -n50.

  3. #3
    Linux Newbie
    Join Date
    Oct 2008
    Posts
    153
    why not just run head on it's own?

    Code:
    [you@yourbox]$ head -n 50 /path/to/file
    alf55 likes this.

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Jul 2006
    Location
    localhost
    Posts
    31
    Better yet, use the actual page size:
    Code:
    head -n $LINES /path/to/file
    In some cases the $LINES variable is broken, as seen in this article bash - LINES and COLUMNS environmental variables lost in a script - Stack Overflow , in which case you need to replace "$LINES" with "$(tput lines)" (credits to Puppe in the link above).

  6. #5
    Just Joined!
    Join Date
    Jun 2013
    Posts
    2
    The tput command is not available on my system. Is there another way to get the actual page size?

    Code:
    tput: command not found

Posting Permissions

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