x
Loading
 Loading
Hello, Guest | Login | Register

Doing More with less, Part Two

You probably use less all the time, but do you use all its power? Jerry Peek shows you how to get the most out of less in the second part of his look at the less utility.

Over the years, I’ve shown a number of uses in the “Power Tools” column for less the handy pager program that has more features than more (and is the default on most Linux distros). In this column, I’ll discuss advanced search techniques, new features in less version 394, how to scroll sideways, and much more.

Changing Options Interactively

Last month, you saw how to set default options in the LESS environment variable and in a lesskey file. Many options can be reset as you’re running less. Simply type a dash, the option name string, and any argument to the option.

If the option is a toggle, its value will be toggled. For example, if you’re using less to read a manual page via man, the option -i (--ignore-case) is set by default so searches using the / command are case-insensitive. While you’re reading a manual page, typing -i or --ignore-case makes searches case-sensitive. less explains the option that’s been changed with a message Case is significant in searches(press Return). (You generally don’t need to press Return; just type the next command.)

If you type an option name that requires an argument, less immediately prompts for the argument. If you type -j, which sets the line number on the screen where the next search target will be displayed, you’ll see the prompt Target line: at the bottom of the screen. Enter the line number and press Return.

To see the description and current setting of an option, type the…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. KDE 4.4: Does It Work Yet?
  2. Writing Custom Nagios Plugins with Python
  3. Power Up Linux GUI Apps
  4. Tweeting from the Command Line with Twyt
  5. When Memory Serves You: Using ramfs and tmpfs
Follow Linux Magazine
Rackspace