26

Is there an shortcut in nano for moving through a line faster? I have some log files with gigantic lines and getting to the middle of them is awful.

I know I could use a different text editor that doesn't have this particular problem (less will wrap lines), but I'm used to nano and I like a lot of its other features.

quantka
  • 920
  • 1
  • 10
  • 15
  • 4
    You can also `Esc + m`, to enable mouse support. Then just click on the position where you want the cursor. – a06e Sep 17 '17 at 16:36

1 Answers1

46

Here are the shortcuts for moving through a line in nano.

Use these to go faster through a line:

ctrl + space move one word forward in a line.

alt + space move one word backwards in a line.

Other line shortcuts:

ctrl + f move one character forward in a line.

ctrl + b move one character backwards in a line.

ctrl + a move to the beginning of a line.

ctrl + e move to the end of a line

To move to a specific line use ctrl + _. You may want to check out more Nano Keyboard Commands

Sven Rojek
  • 5,476
  • 2
  • 35
  • 57
  • 16
    For the record, Alt-Space doesn't seem to to work in OS X, the key combo is Esc-Space. But Ctrl-Space works fine, and is a great shortcut. I've been using Nano (and Pico before that) for 20 years and didn't know about it! – miken32 Dec 06 '16 at 00:34
  • Unfortunately Esc-Space doesn't work for me on OSX. I had to do the following: Terminal > Preferences > Profiles > Keyboard > "Use option as meta key". – mbuc91 May 19 '19 at 20:07
  • 1
    Both ctrl + space (move one word forward in a line) and alt + space (move one word backwards in a line) shortcuts don't seem to work in my macOS High Sierra. – JayB Kim Jun 29 '20 at 01:47