7

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?

9
  • 1
    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, 2012 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, 2012 at 13:55
  • Note: Use ps -C gedit to search for an known app and avoid to double grep. Jan 9, 2012 at 14:05
  • 1
    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. Jan 9, 2012 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, 2012 at 14:15

1 Answer 1

3

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .