Jump to Top or Bottom of File Using the Nano Linux Command

September 23rd, 2011 - Posted by Steve Marks to Server Management, Web Development.

When viewing and editing files, Linux’s nano command can be very useful. One of the primary reasons for my usage of nano is reading log files that can be hundreds, if not thousands of lines long. In this scenario one of the most useful commands required is to quickly jump to the top and bottom of the file, especially seeing as log files are normally date ordered. As a result I wanted to share with you how to do this in just a couple of keystrokes.

Jump to the bottom of the file

The are two steps involved in doing this. The first is to press ‘Ctrl + _’ (underscore). This will ask for a line number at which point then press ‘Ctrl + V’. This will move the cursor directly to the bottom of the file.

Jump to the top of the file

This process is similar to the above but instead of pressing ‘Ctrl + V’, press ‘Ctrl + Y’. Voila, you’re back at the top in just four keystrokes.

This entry was posted on Friday, September 23rd, 2011 at 7:42 pm by +Steve Marks and is filed under Server Management, Web Development. You can follow any responses to this entry through the RSS 2.0 feed.

Fear not, we won't publish this

Comments (2)
  1. Uday says:

    ctrl+w+v for bottom of the file and ctrl+w+y for top of the file

  2. Nishant says:

    Thanks a lot for this. I prefer using Nano over vim since its easier to use for newbies. I appreciate the shortcuts you provided.

    You might want to make a correction though. For “goto line” its (Ctril + Shift + Underscore), otherwise, people would just end up zooming out of the terminal.