I can select all file by going to the 1st line Alt+\, start marking the text by Alt+A, go to the last line by Alt+/

But there, I don't know which key to remove the selected text. Hit delete doesn't work for me but Ctrl+K to cut the text will destroy my clipboard.

So, what is the hotkey to delete selected text?

10 Answers 10


nano of course can delete blocks, see this article

  1. use CTRL+Shift+6 to mark the beginning of your block
  2. move cursor with arrow keys to end of your block, the text will be highlighted.
  3. use CTRL+K to cut/delete block.

To paste the block to another place, move cursor to the position and the use CTRL+U. You can paste the block as often as you want to.

  • 4
    Linux Mint seems to accept CTRL+ALT+6 to mark the beginning of the block. – pbaldauf Dec 5 '16 at 8:42
  • This is a superior answer – KhoPhi Feb 15 '18 at 10:12
  • 6
    The shortcut for marking the beginning of the block is actually CTRL + ^. So CTRL + SHIFT + 6 might not be correct depending on your keyboard layout. – nibarius Feb 22 '18 at 9:44
  • 5
    As asked, we seeks for the way that not affecting the clipboard. Thanks anyway. – Nam G VU Dec 9 '18 at 7:06

nano does not support deleting a block of text, only cutting it (to the server's clipboard).

Instead, if you are using Putty, do the following:

  1. Select the text you wish to copy to the clipboard with the mouse first -- this copies it to your local clipboard (i.e. Windows 7 clipboard), which nano can't touch:

    enter image description here

  2. Then, select your block in nano and use Ctrl-K to delete it.

  3. Finally, move your cursor to the position where you want to insert the text you copied in Step 1 (you can close nano, open another file, etc. too as long as you don't select another block of text with the mouse). Right-click to paste the copied text at the cursor position.

  • 4
    This doesn't work for long lines. The moment you see that $, the line will be truncated. – NightKnight on Cloudinsidr.com Feb 22 '16 at 20:07
  • 1
    nano does support cutting of blocks Ctrl+Shift+6, highlight, Ctrl+k – alleyoopster Feb 6 '18 at 15:26

deletes current line, It can also be useful for quick editing. Thanks


In some of the putty streams, the following works too

  • 1
    Thank you alot, this is the answer! – Daniel Eisenreich Sep 25 '19 at 10:14
  • ctrl+shift+k in more than one line add incrementally into internal clipboard (of nano), and only ctrl+k, stores only the latest text. – danilo Jan 28 '20 at 21:09

If you are trying to empty all of the lines.

A pretty elegant and simplest approach is from the bash-cli:

  • echo "" > filename.txt
  • nano filename.txt

Sadly, nano doesn't seem to have any way of bulk-deleting without clobbering the clipboard.

The safest thing to do while staying within the document is probably to paste your clipboard before deleting, then re-cut it again afterwards.

If you have a block of text already selected, then Ctrl+U will paste the clipboard text, including it in your selected block. You can then unmark the pasted text and just cut your originally selected block.

These steps don't preserve your clipboard, exactly, but at least effectively perform a swap between your selection and the clipboard, allowing you to re-cut the lines you had in there before.


To delete multiple block without overriding your clipboard, first mark the text with Alt+A (You will appear Mark Set then select the text using arrow keys) and then use Ctrl+Shift+K to delete selected text,deleted text won't appear in clipboard.


You could open up a separate buffer to stash your clipboard in:

  • Make sure "reading into separate buffer" is enabled (you can toggle this with Alt+F)

  • Use Ctrl+R and press Enter (without entering a filename), to open a blank file buffer

  • Paste your current clipboard in there with Ctrl+U

  • Use Alt+< or Alt+> to switch between open buffers

  • Thanks but that seems overkill the line delete need – Nam G VU Jun 3 '17 at 15:38
  • 1
    Yeah, I agree.. To be honest, I'd probably recommend posting the issue as a bug report. Sadly they don't seem to have a section for feature requests, but there are existing reports with [Request] in the title. – mwfearnley Jun 4 '17 at 16:22

Recent versions of nano (3.2+) now have this feature if you enable the zap option. Put set zap in your nanorc (or start nano with -Z/--zap), select the text your want to delete, and hit to delete your selection without affecting the cutbuffer.


As pointed out by @saagarjha around version 3.2 of nano they introduced a zap command which allows you to delete text without affecting the cutbuffer.

M-Del Throw away the current line (or marked region)

To delete a line by itself use Alt+Delete with the cursor on the line you want to delete.

To delete a block of text, first set the starting mark with Alt+a and select the text to be deleted and finally press Alt+Delete.

  • Will try alt-delete and pick yours as accepted if it's that simple confirmed. – Nam G VU Jun 22 '20 at 1:09

In Nano

Ctrl + 6 to set a mark

Alt T will delete all content in a file

Ctrl K will delete the current line at your cursor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.