If you are reading a big text file in windows command prompt, then more command will be useful to print the content of the file one page at a time. Here one page means the data that can be fitted into the command window. ‘More’ command on windows is similar to the more command on Linux.
More command can also be used for reading the output of other commands/applications’ output in the console. This command’s usage is explained below.
Print the contents of a file, one page at a time.
more data.txt
When the above command is executed, you will see one page of text from the file printed in the command window. If the file
has more content to be displayed, you can see the second page by pressing space bar key. You can do so till you reach to the end
of the file. You can exit the command by pressing ‘q’ at any page.
More command can be used to display the output of other commands output in the above fashion. We can use redirection operation (|) for this.
command | more
For example, if you want to run ‘dir‘ command in a directory with large number of files, you can user more command, to look at the list of the files, one page
at a time. The command for this is given below.
dir | more
Advanced options of more command:
more /C data.txt
This would clear the current screen text and then would print the contents of the file data.txt
Read file from n+1 th line instead of reading it from the first line:
more +n filename
Example:
To skip first 100 lines in data.txt and print data from 101 th line, the command is:
more +100 data.txt
{ 0 comments… add one now }