It is given in the man page of
f is used to skip forward k screenful of text(default to 1).I saved a very long file using
cat and used
more to show it on the screen page by page but when i pressed
f on the first page itself, it is not navigating forward but it shows
... skipping 29 lines and then the file closes and the prompt returns.When i try to navigate with
spacebar it is working properly as expected. As file length is sufficiently long,it should navigate forward by skipping 1 page each time. Why it is showing such a different behviour?
It is given in the man page of
Try this experiment:
- Open a terminal with 25 rows.
seq 1 1 100 > test_text.
- Look at the line before last on your screen. It'd say
- Press f to skip a page.
- Look at the first line on screen. It'd say
f skips a page of text. So you saw the first "page" of the file, you pressed f, and you saw the third page.
At this point, if you press f again, you'll see
... skipping 24 lines and the last 4 lines of the file.
more'll exit because there are not enough lines to show a fifth page.
Try again using space instead. space does not skip pages. You'll see all the pages.
This answer refers to
more version 5.19 (Berkeley 6/29/88), which is currently in use in the Linux community (see man more). As @Kusalananda reports, the result of the "experiment" may vary on different versions/unices.
Difference between a
line and a
row of text on a terminal
Often these two definitions are interchangeable. In this case, it is important to distinguish them.
- A line is a sequence of characters in a text file that ends with a newline (the
wc -lcommand counts the number of lines in a file. The length of a line can be any number between zero and infinite.
- A row of text (on a terminal) is a sequence of characters displayed on a terminal. It has the fixed length of the width of the terminal.
My first "experiment" was too simple, all the lines were (quite for sure) shorter than rows.
In your file, probably, the lines are way longer than rows. To display them,
more will arrange each line on multiple rows.
Let's try a new experiment:
Create a file
examplewith this content:
006 XX\n010 XXYYYY\n015 XXYYYYZZZZZ\n
This is a 3 line file. The length of each line is, in the order: 6, 10 and 15 characters. Do not forget to count the space after the number.
wc -l example. 3 is the result.
On a 8 columns terminal, you should see something like
006 XX 010 XXYY YY 015 XXYY YYZZZZZ
The first row is 8 character lenght:
006+ a space +
XX+ 2 spaces.
The second row is 8 character lenght:
010+ a space +
The 3rd row is 8 character lenght:
YY+ 8 spaces.
Your 3 lines of text are now 5 rows of text.
The manual page of
f Skip forward k screenfuls of text. Defaults to 1.
This means that
more will skip so many line of text to fill all the rows of the terminal.
but it shows
...skipping 29 linesand then the file closes and the prompt returns
That happens when you press
f and you reach the end of the document.
For example: You have a file of 40 lines, you do
more myfileof60lines.txt, it displays the 29 first lines, then you press
f, so it will skip the 29 next lines, but before that, it reaches the end of the document. So you end up with seeing
...skipping 29 lines, and the normal behavior of
more when it reaches the end of the document, which is a return to prompt.