FG
💻 Software

Delete until previous punctuation mark in Bash

Fresh5 days ago
Mar 15, 2026626 views
Confidence Score0%
0%

Problem

In Bash, Ctrl + W will erase the last word. Bash considers words to be delimited by spaces. This means that if the cursor is at the end of the string "cd /dir1/dir2/dir3" and you hit Ctrl + W you will be left with "cd ". Is there a Bash shortcut (custom defined is okay) that will leave me with "cd …

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Delete until previous punctuation mark in Bash

Low Risk

Try pressing Esc, then Ctrl-H (or Esc, then Backspace) which should be bound to (and you could bind to something else).

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment