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.7, 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 on your keyboard.

Figure 1.7. 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:

1.
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.7).

2.


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

3.
q

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

Tip

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


Tip

You can also use less to view files. less is very similar to more, but more powerful and flexible.


Tip

You can also view files using the cat command. See the next section, Displaying file contents with cat , for the full scoop.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.1.239