Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How does one find and replace text in all open files with gedit?

share|improve this question
up vote 8 down vote accepted

This is not possible with a stock gedit; there's an open ubuntu brainstorm idea for adding the ability. However, there are plugins that add it, such as advanced-find. If you install that, one of the sections on the "Advanced Find/Replace" dialog is "Scope"; choose "All Opened Documents":

Screenshot of the Advanced Find/Replace dialog

share|improve this answer

Generally people who want to do this write an ed script and run it against all the files. E.g.:


And then run it like this

find . -name '*.c' -exec "ed <edscript"

You can also use an ex script which allows you to use all the : commands from vi. It's the same binary as vi just called using the command ex to start without the gui.

share|improve this answer
or with GNU sed: sed -i -e 's/ThrityLimit/ThirtyLimit/g' *.c. Or perl -i -pe 's/ThrityLimit/ThirtyLimit/g' *.c. With zsh or bash 4, you can traverse subdirectories with **/*.c. – Gilles Feb 24 '11 at 20:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.