ECN No Name Newsletter: September, 1992

The ECN No Name Newsletter is no longer being published. This is an archived issue.

[previous article] [next article]

Less Is More!

Dave Halsema

Many students may already be familiar with the more command. More is a screen pager that allows one to view text one screenful at a time. However there are some disadvantages to using more, and this is where another screen pager by the name of less comes in.

Less allows the user to move forward and backwards in a text file in a fashion very similar to the vi editor. Less allows you to search in both directions for any string and also supports the ability to jump to any line number within the file.

The less program is located in /usr/unsup so it might be wise to add this directory to your path. To invoke less on a file simply type "less ", where is the name of the file you wish to view.

Less has a built in help screen which shows all of the commands available. The help screen is obtained by pressing the letter "h". If you are going to remember any of the commands, this is the one to remember! Once in less you can scroll the text one screen forward by pressing the spacebar or by pressing the letter "f". Backing up one screen is accomplished by pressing the letter "b". To search for a string within your document press the slash key "/" followed by the string you wish to find and press return. The line containing your string will be placed at the top of the screen. If you wish to find the next occurrence of the same string press "n". Now the line on top of the screen will show the next line where your string was found. Jumping to a particular line number is just as easy. Type the number of the line you wish to go to, followed by the letter "g". For example, pressing "10g" will place the tenth line on the top of the screen.

When you are done viewing your text you may exit less by pressing the letter "q". I encourage you to try less if you have not already done so and experiment with the other commands available. If any problems arise you can contact me by sending e-mail to halsema@ecn.purdue.edu.


webmaster@ecn.purdue.edu
Last modified: Wednesday, 15-Oct-97 15:46:25 EST

[HTML Check] HTML