Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a whole word on the right in Linux Bash Shell command line [duplicate]

How can I delete a whole word to the right in Linux Bash Shell command line?

Such as this:

  • Ctrl + U = Delete left of the cursor
  • Ctrl + K = Delete right of the cursor
  • Ctrl + W = Delete word on the left

I want to know a shortcut to delete a whole word on the right, no matter where the cursor is in the word. It is just like in Vim opt it is:

daw

And I want to the same result on the Bash command line.

like image 878
VictorLee Avatar asked Dec 29 '18 06:12

VictorLee


People also ask

How do I delete a whole word command?

In most Windows programs and Microsoft Office programs, by moving the cursor at the end of the word you want to delete, pressing and holding down the CTRL key, and then pressing the backspace key, you will delete an entire word in minimal time.

How do you delete a text in Linux terminal?

Delete Text on the Command LineCtrl+D or Delete – remove or deletes the character under the cursor. Ctrl+K – removes all text from the cursor to the end of the line. Ctrl+X and then Backspace – removes all the text from the cursor to the beginning of the line.

Which of the below command is right for deleting 5 lines from a file?

Sed Command to Delete Lines: Sed command can be used to delete or remove specific lines which matches a given pattern or in a particular position in a file.

Which command is used to delete a word in Ubuntu?

The rm command deletes files in a Linux. The command unlinks the data from the file name, allowing the user to overwrite on that particular storage space. Wildcards can be used with this command. This will erase any file that has the word sample in the name.


1 Answers

Use Esc + D or Alt + D to delete the word on the right.

like image 79
tshiono Avatar answered Oct 05 '22 20:10

tshiono