Open Source Musings The thoughts, ideas, and opinions of an open source guy

Using more

A magnifying glass

Text files and Linux go hand in hand. Or so it seems. Just how you view those text files depends on what tools you’re comfortable with.

When you’re at the command line, there are a number of utilities that enable you to view text files. One of them is more.

more is similar to another tool I discussed in this space before called less. The main difference is that more only allows you to move forward in a file.

While that seems limiting, it can be useful to know about what more can do. Let’s take a quick look at how to use it.

The basics

Let’s say you have text file and want to read it at the command line. Just open terminal, pop into the directory that contains the file, and type the following command:

more filename

For example, more

Viewing a file with more

Press the space bar on your keyboard to move through the file, or press q to quit.

If you want to search for some text in the file, press the / key followed by the word or term you want to find. For example, to find the word website, type:


Searching for a word in a file with more

The search is case sensitive. Typing Website isn’t the same as typing website.

Using more with other utilities

You can pipe text from other command line utilities into more. Why do that? Sometimes, the text that those tools returns spans more than one page.

To do that, type the command and any options, followed by the pipe symbol (|), followed by more. For example, let’s say you have a directory that has a large number of files in it. You can use more with the ls command to get a full view of the contents of the directory:

ls | more

Using more with the ls command

I’ve also used more with the grep command (to find text in multiple files). In this example, I use grep to find the text command line in multiple source files for my blog posts:

grep ‘command line’ *.md | more

Using more with the grep command

Another utility that you can combine with more is ps (which lists processes that are running on your system). Again, this comes in handy when there are a large number of processes running on your system and you must get a view of all of them — to, for example, find one that you need to kill. To do that, run:

ps -u scott | more

Where you’d replace scott with your user name.

Using more with the ps command

As I mentioned at the beginning of this post, more is easy to use. It’s definitely not as flexible as it’s cousin less, but it can be useful to know.

Thoughts? Let's start a conversation on Twitter.

Did you enjoy this post or find it useful? Then please consider supporting this blog with a micropayment via Liberapay. Thanks!