Viewing File Contents with more

Viewing File Contents with more

As you become more familiar with Unix, you'll want to start exploring the contents of files, including some program files and scripts as well as files you (eventually) create. One of the easiest ways to view file contents is to use the more command, which tells Unix to display files onscreen, a page at a time. As shown in Figure 1.8, long files are displayed with "More" at the bottom of each screen so that you can move through the file one screen at a time using the z.

Figure 1.8. The more command lets you move through a file one screen at a time, providing a "More" indicator at the bottom of each screen.

To view a file with more:


more fortunes

At the prompt, type more plus the name of the file you want to view. You'll see the contents of the file you requested, starting at the top (Figure 1.8).


Press the to see the next screen of information. As you move through the file, you can press to move back through previous screens.


When you're done, press to go back to the shell prompt.


  • If you want to view just an additional line (rather than an entire screen) when using more, press instead of the .

    You can also use less to view files. less is very similar to more, but more powerful and flexible. How can less be more and more be less? As you'll see in Appendix C: Commands and Flags, the more command has 10 options or so; the less command has about 40.

  • You can also view files using the cat command. See the next section for the full scoop.

Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: