For the tty line discipline, `^W` deletes the previous white-space delimited _word_.

In the `vi` editor in insert mode, `^W` deletes backward to the start of the first sequence of alnums or non-alnums (on `foo-+-bar.. baz`, it first deletes `baz`, then `.. `, then `bar`, then `-+-`, then `foo`).

In the `emacs` editor, `^W` deletes from the cursor position to the _mark_ (the one you set with <kbd>Ctrl+Space</kbd>).

Some line editors like `readline` (used by `bash`, `gdb`...), `zle` (used by `zsh`), `pdksh`'s when in `vi` mode, behave like `vi` in that regard and when in `emacs` mode behave like the tty line discipline (not `emacs`).

`libedit` (used by BSD shells or (optionally) `dash`), `tcsh`, AT&T `ksh`, in `emacs` mode, behave like `emacs` where `^W` deletes to the _mark_ (initially at the beginning of the buffer).

For deleting a word forward, in the `vi` editor, you'd do it in _command_ (_normal_) mode with `dw` to delete to the beginning of the next sequence of alnums or non-alnums (or the end of the line) and `dW` to delete to the next sequence of non-blanks (the pendant of the `^W` of the tty line discipline).

In the `emacs` line editor, <kbd>Meta-D</kbd> would delete to the _end_ of the next sequence of alnum characters. The word motion operators (<kbd>Meta-B</kbd>, <kbd>Meta-F</kbd>) behave similarly.

command line editors, when in `vi` mode, behave like `vi`, but in `emacs` mode, you have two main schools: the `tcsh` school and the `ksh` school.

The `ksh` school (`readline`, `ksh`, `yash`) behaves mostly like `emacs` (`fish`'s behaviour is slightly different in how it treats non-alnum, non-whitespace characters in both `emacs` and `vi` mode).

In the `tcsh` school (`tcsh`, `libedit`, `zsh`), word motions are based on whitespace-delimited words so are consistent with the tty line discipline's `^W` in that regard.

In `zsh`, the behaviour is [customizable](http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Widgets-1) with different _word styles_ for all the word motion widgets.

For `readline`, you can get the `tcsh` school (and have <kbd>Meta-D</kbd> delete the same kind of word as <kbd>Ctrl-W</kbd> does) by adding to your `~/.inputrc`:

 set keymap vi-move
 "\e[EMACS~": emacs-editing-mode
 set keymap emacs
 "\e[VI~": vi-movement-mode
 "\ed": "\e[VI~dW\e[EMACS~"
 "\ef": vi-fWord
 "\eb": vi-bWord

Or on the other hand, align `^W` to the other word motion widgets (behave like <kbd>Meta-Backscape</kbd>) with:

 set keymap emacs
 "\C-W": backward-kill-word


As to what the <kbd>Meta</kbd> key is, see [there](/a/368871).