Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On bash command-line, how to delete all letters before cursor?

On bash command-line, how to delete all letters before cursor? I know Ctrl-k deletes all afterward the cursor.

like image 741
qazwsx Avatar asked Sep 08 '12 21:09

qazwsx


People also ask

How do you delete a character after a cursor?

Click the left mouse button to place the cursor after the last character. Press Backspace one or more times to delete the characters in front of the cursor.

What is Ctrl Z in bash?

ctrl+z stops the process and returns you to the current shell. You can now type fg to continue process, or type bg to continue the process in the background. Research "bash job control" and see bash manual Job Control Basics.


1 Answers

Ctrl-u - Cut everything before the cursor


Other Bash shortcuts,

  • Ctrl-a Move cursor to beginning of line
  • Ctrl-e Move cursor to end of line
  • Ctrl-b Move cursor back one word
  • Ctrl-f Move cursor forward one word
  • Ctrl-w Cut the last word
  • Ctrl-k Cut everything after the cursor
  • Ctrl-y Paste the last thing to be cut
  • Ctrl-_ Undo

And discover more via man page for bash shell: man bash

Additional bash command-line shortcut cheat sheet: http://www.bigsmoke.us/readline/shortcuts

See the documentation here: http://www.gnu.org/software/bash/manual/bashref.html#Commands-For-Killing

Obligatory: Learn more about Bash, Linux, and Tech through Julia's comics: https://twitter.com/b0rk/media

Julia on Bash

like image 58
Mayura Avatar answered Sep 21 '22 00:09

Mayura