Access Keys:
Skip to content (Access Key - 0)

Determining the current line number in Emacs

The default version of Emacs on Athena has line numbering automatically. If you are using an earlier version, you may have to turn it on.

The line number is displayed in the "mode line" at the bottom of the screen. If you look down at the bottom of the screen, you should see a section that has "--L#--" where the "#" is the line number your text cursor is currently on.

  • If line numbering currently isn't on in your emacs window, just type:
    Meta-x line-number-mode
  • If you wish to turn on line numbering always, you can put the line:
    (setq line-number-mode t)

    in your .emacs file.

  • If you wish to have it always be off, put in:
    (setq line-number-mode nil)

Similarly, there is a column-number-mode that works the same way.

Related Commands

There are several other related commands you can also use to determine the line number and perform line number functions.

  • If you want to find out the number of the line where the cursor is, type this:
    M-x what-line
  • If you want to move the cursor to a particular line, type this:
    M-x goto-line

    followed by the line number.

  • If you want to know how many lines are in a region of text, use:
    M-x count-lines-region



IS&T Contributions

Documentation and information provided by IS&T staff members

Last Modified:

November 16, 2014

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
olc-emacs olc-emacs Delete
emacs emacs Delete
line line Delete
number number Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
This product/service is:
Easy to use
Difficult to use

This article is:
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki