>_ linuxcommand.dev
Startseite :%s/old/new/gc
Vim

:%s/old/new/gc

Replace all occurrences of "old" with "new" in the file, prompting for confirmation before each replacement.

Ubuntu CentOS Debian Arch SUSE Slackware Alpine Fedora
Verified: 2025-10-07
Syntax
$:%s/old/new/gc
Examples
$:%s/error/fix/gc
Typical use cases
?
Standard usage
:%s/old/new/gc --help
Note Search & Replace. Replaces with confirmation.
Export