Linux – Bash readline deleting till the previous slash

bashlinuxreadline

In bash emacs mode, is there anyway to delete till the previous slash character?
For example if i entered the command cp /usr/local/bin/reallylongincorrectfolder /home/myname/reallylong_and_correct_path and want to just delete the reallylongincorrectfolder.Is there any shortcut? This is a very comman scenario for me in bash.
Something like dF<char> in vi?

Best Answer

bind -P |grep unix-filename-rubout

To test out the keybinding with eg. Ctrl-b:

bind \\C-b:unix-filename-rubout

For permanent usage, add it to ~/.inputrc

Related Question