Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

There is a command-line option to see what files are open with gedit? If I open two files in gedit (file1 and file2) and in terminal I use the command:

ps ax | grep-v grep | grep gedit

I get only the first file opened. (5944 pts/0 S+ 0:01 gedit /home/file1)

Using this command I do not see that file2 is also open in gedit. It is another way?

share|improve this question
I think that's an interesting question. On my system even lsof doesn't know about any open files related to gedit even if strace shows they have been opened. – arrange Jan 9 '12 at 11:16
I found a solution to remotely edit a file with gedit as root. And this is the only problem, to know when the edited file was closed... – georgian Jan 9 '12 at 13:55
Note: Use ps -C gedit to search for an known app and avoid to double grep. – user unknown Jan 9 '12 at 14:05
May I ask why you need to know, whether the file is open in gedit or which file is open in gedit? There might be another solution for the underlying problem. – user unknown Jan 9 '12 at 14:13
codeps -C gedit PID TTY TIME CMD 5964 tty1 00:00:01 gedit /code Where is informations about file1 and file2 ? – georgian Jan 9 '12 at 14:15

gedit doesn't keep the file open while you are editing it, so I'm not sure you can. You could probably write a gedit plugin that could tell you, but let's ignore that option for now.

Going on the comments above, you are really just wanting a way to edit a file, and know when it's been closed. @TimoKluck suggests --standalone, but I think you probably want --wait instead.

You can also achieve the same thing through gedit's D-Bus API. When you open a file, it gives you a cookie, which you can then wait on.

share|improve this answer

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.