Home > bash > Less – Adding line numbers

Less – Adding line numbers

Problem:

My initial problem was how to view line numbers when using less. As I looked into this I discovered more and more ways of using less that I did not know.

Solution:

1. less -N file.txt

If you have already viewed the file then typing

-N will enable line numbers while
-n will disable line numbers.

2. To go a specifice line
g N to move upwards to a particular line. The default is 1 (ie g1) and it gets you to the first line of the file.
G N to move forward to a particular line. G alone is the default that gets you to the end of the file.

Advertisements
Categories: bash
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: