How can I show line numbers by default in Eclipse?
The top answer is good but you can also bind it to a key ( shorcut ) to toggle it..
Window > Preferences > Keys then enter "Line Numbers" in filter and bind it to a key.
I use CTRL + S + L.
in this file
[workspace].metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.ui.editors.prefs
make sure the parameter
lineNumberColor=0,0,0
is NOT 255,255, 255, which is white
As simple as that. Ctrl+F10, then N, to Show or hide line numbers.
Reference : http://www.shortcutworld.com/en/win/Eclipse.html
Window → Preferences → General → Editors → Text Editors → Show line numbers.
Edit: I wrote this long ago but as @ArtOfWarfar and @voidstate mentioned you can now simply:
Right click the gutter and select "Show Line Numbers":
the eclipse changes the perferences's position
to eclipse -> perferences
If this doesn't work it may be overridden by your current settings. You can right-click in the bar to the left of the code where line numbers would normally appear and turn them on with the context menu.