nano Movement
Linux Commands - Shells

Skills in moving around in large files is very important  for an administrator because config files of 1000+ lines will take a very long time to navigate.

 

Lesson 4 | Lesson 6

Here is an example of opening a file that is longer.  The example is a copy of the /etc/httpd/conf/httpd.conf for the apache web server.  You can create a large file and do the same thing, just do not practice on real config files so that you do not damage them.

Ctrl+X is the same command as ^X, the ^ stands for the Ctrl key.

Alt+_+/ is the same command as M_/ as the M stands for the Alt key.


Remeber open a file with Ctrl+R and then type in the location of the file.

 

nano movement

 

When the file opens you can see that in the middle at the bottom you have a list of the number of lines in the file, here it is 991.

nano

This is a difficult file to move around in as it takes too much time so you have to use some commands.

In order to move to the end of the file use the command:

Alt _/

This is a little harder than it looks.  Use the Alt Key + Shift Key and choose and underscore and then the "/".  That will take you ot the end of the file regardless of size.

nano last line

If you want to move to the start of the file use: Alt_\   Notice the slash is in the opposite direction.

If you want to move to a specific line use this command:

Ctrl+Shift+ _

When you do that an option will open for you to enter the line number to go to.  In the example, line 456 is entered.  Note that you also can use Ctrl+Y to go to the first line  or Ctrl+V to go to the last line when this line numbe option opens.

nano

 

You can also use these commands to move in smaller increments.

^F                      Move forward one character
^B                      Move back one character
^Space                  Move forward one word
M-Space                 Move back one word
^P                      Move to the previous line
^N                      Move to the next line

^A                      Move to the beginning of the current line
^E                      Move to the end of the current line
M-(             (M-9)   Move to the beginning of the current paragraph
M-)             (M-0)   Move to the end of the current paragraph
M-\             (M-|)   Move to the first line of the file
M-/             (M-?)   Move to the last line of the file

M-]                     Move to the matching bracket
M--             (M-_)   Scroll up one line without scrolling the cursor
M-+             (M-=)   Scroll down one line without scrolling the cursor

 

 


Copyright CyberMontana Inc. and BeginLinux.com
All rights reserved. Cannot be reproduced without written permission. Box 1262 Trout Creek, MT 59874