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

:%s/old/new/g

Replace all occurrences of "old" with "new" in the entire file.

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