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?


13 Answers 13


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.

  • 5
    Linux Mint seems to accept CTRL+ALT+6 to mark the beginning of the block.
    – pbaldauf
    Dec 5, 2016 at 8:42
  • This is a superior answer
    – KhoPhi
    Feb 15, 2018 at 10:12
  • 10
    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, 2018 at 9:44
  • 10
    As asked, we seeks for the way that not affecting the clipboard. Thanks anyway.
    – Nam G VU
    Dec 9, 2018 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. Feb 22, 2016 at 20:07
  • 1
    nano does support cutting of blocks Ctrl+Shift+6, highlight, Ctrl+k Feb 6, 2018 at 15:26

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
  • This worked for me, Thank you :)
    – SMshrimant
    Jul 27, 2022 at 8:30

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! Sep 25, 2019 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, 2020 at 21:09

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.


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.


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.

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, 2017 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, 2017 at 16:22

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.

To undo a delete, press Alt+u. To redo a delete, press Alt+e. For me redo didn't work until I disabled alt menu access keys in the preferences of my terminal emulator.

  • 1
    Will try alt-delete and pick yours as accepted if it's that simple confirmed.
    – Nam G VU
    Jun 22, 2020 at 1:09
  • This should be the accepted answer. Additionaly, at least now, you can select the text without setting a mark. Just use Shift and the arrow keys for that.
    – msa
    Apr 20 at 12:37

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.


For me (on a mac) Control + K did what I wanted (deleted a full line)


Ctrl+6 (Sets the mark position)
Ctrl+- (Enter the lines nos to delete)
Ctrl+K (Delete the selection)


Ctrl + T (opens Command to execute tab)

Ctrl + V (Cut Till End)

Tested on Ubuntu Server

  • CTRL+V is page down
    – M.Viking
    Nov 7, 2023 at 14:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .