Linux Command - more
The linux command more will allow you to display and page through a file. It is recommended to use the newer, better command ‘less’ instead.
Commands used within more:
( preceed commands with a number to chagne k value )
space | scroll down one page ( ‘screen size’ lines ) |
enter | scroll down one line |
d | scroll down k lines ( ‘scroll size’ 11 ) |
s | skip forward k lines ( 1 default ) |
f | sip forward k screens( 1 default ) |
b | sip backward k screens( 1 default ) ( not with pipes ) |
q | exit |
h | help |
= | show current line number |
/pattern | search |
n | next search match |
. | go to start of last search |
Page through a file.
more /var/log/dpkg.log
Only scroll 5 lines at a time when paging ( screen size ):
more -n 5 /var/log/dpkg.log
more -5 /var/log/dpkg.log # same but shorter syntax
Clear screen every time ( don’t scroll ):
more -p /var/log/dpkg.log
Clear screen every time and page 5 lines at a time:
more -p -n 5 /var/log/dpkg.log
Start at this line number:
more +2 /var/log/dpkg.log # same but shorter syntax
Using a pipe:
ps -ef | more
-d | suppress sound when invalid key is pressed |
-p | don’t scroll, clear screen and display next page |
-c | don’t scroll, clear screen and display next page |