Using Search bar
Shift
/editor /appearance/
and thenShow line numbers
toggle buttonFor Windows and Linux
File | Settings | Editor | General | Appearance
For macOS
IntelliJ IDEA | Preferences | Editor | General | Appearance
Using shortcut
Ctrl+Alt+S
Then
Editor > General > Appearance
Click on Show line numbers toggle button.