How to delete selected text in nano editor?
You can't select with mouse and delete text using nano editor
. For faster delete you can use Ctrl + K
to delete(cut) the present line of text.
Note : Ctrl + K
will cut the line of text. Using Ctrl + U
you can paste it.
EDIT: Additional Info from steeldriver
You can select and cut something other than the current line using Ctrl-^
to mark the start of the text, then advancing the cursor e.g. using Ctrl-F
(forward one character) and/or Ctrl-Space
(forward one word) and/or arrow keys, and then pressing Ctrl-K
Related videos on Youtube
vaibhav
Updated on September 18, 2022Comments
-
vaibhav over 1 year
How do I delete selected text in the nano editor?
I came across this issue while needing to delete the virtual host file and replace its content completely by other content. But the problem is that I can't select and delete the entire text at once. And if I delete it character by character, it won't be a computer thing.
-
vaibhav almost 10 yearsNo, It's not duplicate. I am particularly asking for deleting the selected content that is not available on link you are saying to be duplicate of.
-
A J almost 10 yearsyour question seems to me like problem in editing a text, now I can understand that you are asking about selecting text using mouse and delete... see my answer...
-
-
steeldriver almost 10 yearsYou can select and cut something other than the current line using
Ctrl-^
to mark the start of the text, then advancing the cursor e.g. usingCtrl-F
(forward one character) and/orCtrl-Space
(forward one word) and/or arrow keys, and then pressingCtrl-K
-
precise almost 10 yearslike @steeldriver said.. that's how you delete in nano! First set the mark with
Ctrl + ^
, then select with arrow keys, use the cutCtrl + K
and to delete, don't follow that by a pasteCtrl + U
;) To copy the key combo isAlt + ^
-
Wilf almost 10 yearsSo is the simple answer 'hold down the Backspace/Delete key?' :) +1 Very useful
-
itsazzad over 8 yearslike @steeldriver said.. for selection you can use
SHIFT+ARROW
to move any direction. And for Mac or ifCtrl-^
not work thenCTRL+SHIFT+^
should work. -
nathangiesbrecht about 8 yearsAlso, you can enable the mouse in Nano if invoked with -m option or
set mouse
in ~/.nanorc You can set the mark with the mouse with a double-click.