Deleting multiple lines with nano

That’s not as easy as you might think with nano. Mainly because of the stage keystroke-philosophy of nano. Here is the way I cut out multiple lines, whole paragraphs or also huge text blocks with nano (Xubuntu 14.04, MacOS X 10.9.5).

  1. Open file in nano:

    -c shows line-numbers. Alternatively you can press CTRL+C when you already have opened the file.
  2. Mark starting line with ALT+Shift+A (CTRL+^ on Mac)
  3. Now you can use the arrow-keys (up / down / left / right) to mark the text you want to delete.
  4. If you need to mark very huge textblock, such as to the beginning of the file, you can use one of these keystrokes:
    1. ALT+Shift+/ (ctrl+V on Mac) => Jump to the end of file
    2. ALT+ALT-GR+\ (ctrl+Y on Mac) => Jump to the beginning of the file
    3. ALT+G => Go to line X (enter line number on prompt) (ctrl+shift+_ on Mac)
  5. After you marked the block you want to delete, you simply hit CTRL+K (same on Mac) to delete the lines.
  6. If you want to paste the textblock elsewhere, you can hit CTRL-U (same on Mac) to paste it on the cursor position.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.