x
Loading
 Loading
Hello, Guest | Login | Register

Doing More with less, part one

Developer Mark Nudelman has been working on less since version less-1, released in 1985. This month, let’s cover the Linux version less-394 (yes, it’s the 394th version), but you can also get less for other operating systems, including Mac OS X and Microsoft Windows — which makes it a great cross-platform choice for exploring files and viewing data from pipes.

Developer Mark Nudelman has been working on less since version less-1, released in 1985. This month, let’s cover the Linux version less-394 (yes, it’s the 394th version), but you can also get less for other operating systems, including Mac OS X and Microsoft Windows — which makes it a great cross-platform choice for exploring files and viewing data from pipes.

Assuming you know the basics of less, let’s look instead at overall setup and configuration. Next month we’ll dig into details of using this powerful pager.

Default Options

Set the LESS environment variable in your shell’s setup file (like .profile) with the command-line options less should use by default. For instance, if you like more-verbose prompting (–m), the target of a search to be shown on line 5 of the screen (–j5), search targets not to be highlighted (–G) and marked in the status column instead (–J), set LESS=–mj5GJ.

Some options can have quite a bit of text after the option name, like –P, which sets the less prompt. To explicitly end an option and its text, use a dollar sign ($). For instance, you could set LESS='–mj5$GJ' to mark the end of the option –j and its argument 5. (The single quotes around the value prevent the shell from treating $ as the start of a shell variable.)

To override these default settings, type option names preceded by dash-plus (–+) on the command line. For instance, to override the –J option in the LESS string, type less –+J filename.

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. Got Security? You're in Denial
  2. KDE 4.4: Does It Work Yet?
  3. Writing Custom Nagios Plugins with Python
  4. Power Up Linux GUI Apps
  5. Tweeting from the Command Line with Twyt
Follow Linux Magazine
Rackspace