In Emacs, how do I display the current line or column, or move to a specific line or column?
Note: The Emacs keystroke designations differ from the ones used in the rest of the Knowledge Base. For clarifications, see In Emacs, how are keystrokes denoted?
These commands are useful for moving to and/or displaying lines and columns:
| Go to a specific line: |
M-x goto-line
|
| Display the current line: |
M-x what-line
|
| Count the lines on the current page and display the current line*: |
C-x l
|
| Display line number in the mode line: |
M-x line-number-mode
|
| Display column number in the mode line**: |
M-x column-number-mode
|
*In Emacs, a page is defined as the space between
C-l characters. Emacs will return the wrong value if you
enter this command at the beginning of a line.
**Requires Emacs 20 or higher. Emacs 21 is available on all UITS central systems at Indiana University.
To enable line-number-mode by default in Emacs, enter the following
into your .emacs file:
(setq line-number-mode t)
Likewise, if you are using Emacs 20 or higher, you can also enable
column-number-mode by default by entering into your
.emacs file:
(setq column-number-mode t)
For more information, see the Emacs FAQ.
At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?
Last modified on October 27, 2010.







