You are currently viewing Linux Commands – more

Linux Commands – more

Linux Commands – more

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed diff command in Linux which is used to compare the contents of files and directories.

https://cloudaffaire.com/linux-commands-diff/

In this blog post, we will discuss more command in Linux. more command is used as a filter for paging through text one screenful at a time. If you have a very long file that does not fit in the current screen, you can use more command to view the contents one screenful at a time. more command can work directly with a file or can be used with a pipe.

more command provides interactive mode like vi to interact with the file content. Below are different commands and their details that can be issued within more output in interactive mode.

command details
h or ? Help; display a summary of these commands
SPACE Display next k lines of text. Defaults to current screen
z Display next k lines of text, defaults to current screen size
RETURN Display next k lines of text, defaults to 1
d or ^D Scroll k lines, default is current scroll size, initially 11
q or Q Exit more
s Skip forward k lines of text, defaults to 1
f Skip forward k screenfuls of text, defaults to 1
b or ^B Skip backwards k screenfuls of text, defaults to 1. Only works with file not pipe
Go to the place where the last search started
= Display current line n
/pattern Search for kth occurrence of regular expression, defaults to 1
n Search for kth occurrence of last regular expression defaults to 1
!command Execute command in a subshell
v Start up an editor at current line
^L Redraw screen
:n Go to kth next file, defaults to 1
:p Go to kth previous file, defaults to 1
:f Display current file name and line number
. Repeat previous command
  ** Some commands may be preceded by a decimal number, called k

 

Linux Commands – more:

more command is used as a filter for paging through text one screenful at a time.

more command has an interactive mode like vi that enables you to interact with the output.

You can use more -<number> options to specify the of lines per screenful. The argument is a positive decimal integer.

You can use more +<number> to display file beginning from line number. The argument is a positive decimal integer.

You can use more +/<string> to display file beginning from search string match.

You can use more -s or –squeeze options to squeeze multiple blank lines into one.

You can use more -l or –logical options to not pause after any line containing a ^L (form feed).

In the interactive mode of more, if any illegal key is pressed, one bell alert is sounded. You can use more -d or –silent options to display help and suppress the bell sound when an illegal character is pressed.

more has different options to control the screen scroll. You can use more -f option to count logical rather than screen lines. You can use more -c option to not scroll, display text and clean line ends, and more -p option to not scroll, clean screen and display text.

Hope you have enjoyed this article. In the next blog post, we will discuss less command in Linux.

 

Leave a Reply