165

Does the Nano minimal text editor have a keyboard shortcut feature to jump to a specified line?

Vim provides several analogs.

David Shaked
  • 3,171
  • 3
  • 20
  • 31

9 Answers9

315

In the nano editor

Ctrl+_

On opening a file

nano +10 file.txt
Black
  • 18,150
  • 39
  • 158
  • 271
Ghilas BELHADJ
  • 13,412
  • 10
  • 59
  • 99
55

The shortcut is: CTRL+shift+- ("shift+-" results in "_")

After typing the shortcut, nano will let you to enter the line you wanna jump to, type in the line number, then press ENTER.

Black
  • 18,150
  • 39
  • 158
  • 271
Yibei Huang
  • 716
  • 6
  • 7
  • This is misleading at best: the actual shortcut is 'Ctrl + _'. It just happens that there is a key that produces '-' without Shift and '_' with it on most keyboards. However, this is just a coincidence and 'Ctrl + Shift + -' will not work with numpad's '-' key, for example. – Jozef Mikušinec Oct 15 '20 at 09:16
27

The shortcut is: CTRL+_

Have a look here http://ubuntuforums.org/showthread.php?t=1005737

Martin
  • 522
  • 4
  • 7
7

I am using nano editor in a Raspberry Pi with Italian OS language and Italian keyboard. Don't know the exact reason, but in this environment the shortcut is:

Ctrl+-

Kar.ma
  • 743
  • 6
  • 12
6

According to section 2.2 of the manual, you can use the Escape key pressed twice in place of the CTRL key. This allowed me to use Nano's key combination for GO TO LINE when running Nano on a Jupyter/ JupyterHub and accessing through my browser. The normal key combination was getting 'swallowed' as the manual warns about can more often happen with the ALT key on some systems, and which can be replaced by one press of the ESCAPE key.
So for jump to line it was ESCAPE pressed twice, followed by shift key + dash key.

Wayne
  • 6,607
  • 8
  • 36
  • 93
2

I am using Linux raspi 4.19.118+ #1311 via ssh Powershell on Win 10 Pro 1909 with German keyboard. nano shortcut Goto Line with "Crtl + Shift + -" was not working Solution: Step 1 - Do Current Position with "Crtl + C" Step 2 - Goto Line with "Crtl + Shift + -" IS working!

I dont know what effects it. But now its working without step 1!

2

Try this, for me it works:

Ctrl+Shift+_

Black
  • 18,150
  • 39
  • 158
  • 271
2

Alternatively, on OSX Ventura (nano -version Pico 5.09), Ctrl W (Where is) reveals Ctrl T (Line Number), and you can type in your line number at the prompt.

1

I am using using Ubuntu 20.04 on Win 11 Pro with a Spanish keyboard the nano shortcut to Go To Line is: Ctrl + /.

RdC1965
  • 412
  • 5
  • 8