> ## Content Index
> Fetch the complete content index at: https://linuxhandbook.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Deleting Lines in Nano
- URL: https://linuxhandbook.com/nano-delete-lines/
- Published: 2024-06-07T05:00:00.000Z
- Updated: 2025-08-22T16:05:31.000Z
- Description: Here's all you need to know about deleting single, multiple or all lines in Nano editor.
- Author: Abhishek Prakash
- Tags: Nano Essentials, #docs-col, #group-getting-started

Editing text file in Nano and wondering how to delete entire line? 

In this quick Nano tutorial, I'll show the following:

- Deleting a single line
- Deleting selected few lines
- Deleting all lines of the file

Let's see it in action.

🚧

The delete function is actually cut operation here. The lines you 'cut' are saved to the buffer and you may paste them if needed. If you do not 'paste' them, it is as good as deleting the lines.

## Delete a single line

To delete a single line, move to the desired line first. Use the arrow keys to move around in Nano.

Now press the `Ctrl+K` and it will delete the line at the current cursor position. It doesn't matter if you are at the beginning of the line or not, it will still be deleted.

![delete single line in nano](https://linuxhandbook.com/content/images/2023/10/ctrl-k.svg)

Press Ctrl+K to cut or delete the current line

If you are happy with the decision, [save and exit nano](https://linuxhandbook.com/nano-save-exit/) by pressing the `Ctrl+X` keys.

If you are unhappy with it, you can easily [undo the action in Nano](https://linuxhandbook.com/undo-redo-nano/) using `Alt+U` keys.

## Delete multiple lines

This one is slightly tricky than deleting a single line.

The trick here is to select a block of text first and then use Ctrl+K to cut/delete it.

First, move to the beginning of the line from where you want to start deleting. **It is important that the cursor is at the beginning of the line**.

Now, press `Ctrl+^` (or `Ctrl+Shift+6` as most keys don't have dedicated ^ symbol) to set the mark. Now if you press the down key, it will start selecting the text block.

Go until the end of the line you desire to delete.

If you are happy with the selected text, press `Ctrl+K`.

![delete multiple lines in nano](https://linuxhandbook.com/content/images/2023/10/delete-multiple.svg)

Set mark with Ctrl+^, move arrow to select text and Ctrl+K to delete

If you like the result, save and exit Nano (Ctrl+X) else undo the changes (Alt+U).

## Delete all lines

[Move to the beginning of the file](https://linuxhandbook.com/beginning-end-file-nano/). You can press `Alt+\` keys for that.

Now press `Alt+T` and it will delete [all the text](https://linuxhandbook.com/nano-select-all/) from your current cursor position (which is why you moved to the beginning of the file).

![delete all lines in Nano](https://linuxhandbook.com/content/images/2023/10/delete-all.svg)

Move to start of file with Alt+\\ and press Alt+t to delete all lines

Again, you can easily undo with Alt+U.

That's all you need to know about deleting lines in Nano text editor. Enjoy it.