Skip to content
Home » Discover the Potential of the More Command

Discover the Potential of the More Command

  • Linux
  • 4 min read

The Linux more command is a powerful way to view text quickly, but it’s not always easy to make the most of it. In this blog, we’ll outline five tips for power and advanced users for making the most of the more command. We’ll also provide practical use-cases and examples for each tip, and finish with a challenge to test your newly-gained knowledge!

Tip 1: Use the -N Option to Show Line Numbers

The -N option is a great way to quickly scan text for any specific line you’re looking for. Instead of scrolling through the page, you can find the line number you need and jump right to it. To activate line numbers, just add -N to your more command:

more -N filename.txt

Tip 2: Use the +<Number> Option to Start at a Specific Line

If you know the line you’re looking for, you can save time with the +<Number> option. This allows you to jump straight to the line you need without having to scroll through the whole document. To use this, just add +<Number> to your more command:

more +42 filename.txt

Tip 3: Use the -p Option to Pause After Each Screenful

Sometimes you may want to take a closer look at the text, or just pause and think before continuing. The -p option is a great way to do this, as it pauses after each screenful, allowing you to scroll through the text at your own pace. To activate the pause function, just add -p to your more command:

more -p filename.txt

Tip 4: Use the -f Option to Expand Tabs

When viewing text with the more command, tabs can often appear as a single character. To expand the tabs and make them visible, you can use the -f option. This will make the text much easier to read. To activate the -f option, just add -f to your more command:

more -f filename.txt

Tip 5: Use the -s Option to Squeeze Blank Lines

If your text has multiple blank lines, it can be difficult to read. To make it easier to read, you can use the -s option to squeeze all of the blank lines together into one. To activate the -s option, just add -s to your more command:

more -s filename.txt

Examples of Linux More Command Use-Cases

ls -l |more – This command will list the contents of the directory in long format and pipe it to the more command for easier viewing.

more < itvraag.nl – This command will display the contents of the file itvraag.nl and pipe it to the more command for easy viewing.

more -d itvraag.nl – This command will display the contents of the file itvraag.nl and pipe it to the more command with the -d option for better viewing.

more -f itvraag.nl – This command will display the contents of the file itvraag.nl and pipe it to the more command with the -f option for better viewing.

more -c itvraag.nl – This command will display the contents of the file itvraag.nl and pipe it to the more command with the -c option for better viewing.

Other Viewers

The more command is a powerful tool to view the content of a file, similar to less. It is different than cat, head, and tail in that it displays the content of the file a page at a time, and allows the user to scroll through the document. This makes the more command ideal for viewing large files, as you can easily navigate your way through the document. The more command also allows the user to search for specific text within the document, and jump to different sections. The more command can also be used to view multiple files at once, and is useful for comparing the contents of two or more files.

Conclusion

The Linux more command is a powerful tool for quickly viewing text. With the tips outlined above, you can make the most of it and quickly find the information you need. To test your knowledge, try using the -N, +<Number>, -p, -f, and -s options all in one command!

Leave a Reply

Your email address will not be published. Required fields are marked *

2 × 3 =