

If you want to search for a text string, hit Ctrl+W, and enter your search term. This signifies that there’s more text both before and after the portion being displayed on screen. You can see that the line the cursor is on has a “$” at both the beginning and end. Since line wrapping is set to “on” by default, this usually comes in handy in the opposite way for example, you’re writing a config file and want to disable line-wrapping.

You know how in notepad, you can force long lines of text to wrap-around into what look like paragraphs? You can toggle that feature in nano with the Meta+L shortcut.

This sometimes comes in handy when editing configuration files. If you want to remove an entire line of text, simply hit Ctrl+K without highlighting anything. To Paste your text, move the cursor to a suitable position and hit Ctrl+U. If, instead, you want to cut the text, hit Ctrl+K. If you messed up, just hit Ctrl+^ again to unset the marker and you can start over. Be careful, however, as you can edit text while your marking. You can also mark backwards from your “set” point. Note that the cursor is on the empty space, and copying/cutting will not include this space. This will mark everything between the starting point up to and NOT including the cursor. You simply move the cursor to where you want to start marking, and then you hit Ctrl+^ to “set” it. Similarly, in nano we “mark” it by using the Ctrl+^ command. When we want to copy text in graphical environment, we highlight it with the cursor. If you want to see where your cursor currently is, sort of like nano-GPS, hit Ctrl+C.

And, if you’re really in a rush, you can hit Ctrl+_ and then type in the line number, a comma, and the column number to jump straight there. Want to move pages at a time instead? Ctrl+V moves down a page, and Ctrl+Y moves up a page.īut wait, there’s more! To move forward and backward one word at a time, you can use Ctrl+Space and Meta+Space (remember, that’s Alt+Space). Missing the Home and End keys? You can use Ctrl+A and Ctrl+E. In other words, you can use those keys instead of the Right, Left, Up, and Down arrows, respectively. To move up and down one line at a time, you can type Ctrl+P and Ctrl+N. To move the cursor forward or backward, you can type Ctrl+F and Ctrl+B. Of course, you can always use the Home, End, Page Up, Page Down, and the arrow keys to get around, but that requires moving your fingers from the letters that we all love so much. Now that we’ve got a hang of shortcuts, let’s get used to moving around a text file very quickly. Nano will politely ask you if you want to save your buffer, and you can cancel this action as well. When you want to quit nano, you just hit Ctrl+X. On most keyboard layouts, Meta equates to the Alt button. There are also some commands that require use of the Meta key. You can hit Escape twice instead of holding down the Control key, if you have trouble doing that. You can cancel both of the previous commands by typing Ctrl+C. If you want to insert the contents of another file into your current buffer, you’d type Ctrl+R. You’ll be prompted for a filename to use, and the shortcuts at the bottom will change to reflect what you can enter to complete this particular command. This is called “writing out” and is executed by hitting Ctrl+O. Let’s say you’re working on a new text file, or “buffer,” and you want to save it. When you’re done looking at the list, hit Ctrl+X to exit help. Hit Ctrl+G to bring up the Help documentation and scroll down to see a list of valid shortcuts. All shortcuts use lowercase letters and unmodified number keys, so Ctrl+G is NOT Ctrl+Shift+G. Note that nano does not use the Shift key in shortcuts. The most common ones are listed at the bottom of the screen, but there are many more that aren’t. Program functions are referred to as “shortcuts” in nano, such as saving, quitting, justifying, etc. It’s pretty simple, so type some text out, or copy something and paste it into your terminal so we have something to play with. It’s a WYSIWYG editor “what you see is what you get.” What you type directly goes into the text input, unless you modify it with a key like Control or Meta.
