Tech News
← Back to articles

Assorted less(1) tips

read original related products more articles

"word to your moms, I came to drop bombs, I've got more less tips than the Bible's got Psalms."

In a recent discussion on Reddit I shared a number of tips about the common utility less(1) that others found helpful so I figured I'd aggregate some of those tips here.

Operating on multiple files

While most folks invoke less at the tail of a pipeline like $ command | less Invoking less in a pipeline you can directly provide one or more files to open $ less README.txt file.c *.md Invoking less directly

Adding files after starting

When reading a document, sometimes you want to view another file, adding it to the file list. Perhaps while reading some C source code you want to also look over the corresponding header-file. You can add that header-file to the argument list with :e file.h

Navigating multiple files

You can navigate between multiple files using :n to go to the next file in the argument-list, and :p for the previous file. You can also use :x to rewind to the first file in the argument-list similar to how :rewind behaves in vi / vim .

Removing files after starting

While I rarely feel the need to, if you have finished with a file and want to keep your argument list clean, you can use :d to delete the current file from the argument-list.

... continue reading