Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-19-2011, 08:02 AM   #1
Registered: Jun 2010
Distribution: Ubuntu, CentOS
Posts: 33

Rep: Reputation: 0
Closing a file...

If a file is opened from the comman prompt with something like:

gedit somefile &

Is there a way to close somefile while leaving the instance of gedit still open?

My idea is that sometimes I will have more than one file open in gedit. I run a script daily that updates to a log file. The log file is then opened and viewed with gedit.

Thanks for any help or suggestions.
Old 04-19-2011, 08:14 AM   #2
Senior Member
Registered: Oct 2003
Posts: 2,564

Rep: Reputation: 214Reputation: 214Reputation: 214
In gedit, just click on the somefile tab's "x" instead of the window bar "x".
Old 04-19-2011, 08:37 AM   #3
Registered: Jun 2010
Distribution: Ubuntu, CentOS
Posts: 33

Original Poster
Rep: Reputation: 0
I needed to be a bit more specific.

From the command prompt, how can I close one file that is opened in gedit, while leaving other files opened with gedit.

Hope this clears things up a bit.
Old 04-19-2011, 10:00 AM   #4
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,087

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
kilgoretrout gave you the answer.

You need to look closely at your gedit window when it has a file open.

On the line below "Open" "Save" etc there is a little tab with the name of your file. Try opening another file - it'll have a little tab as well.
On those tabs is an X Clicking it closes the file not gedit.

Edit: If you want to do this from the command line (close one tabbed file in gedit, leaving the others open) I do not think you can do this, but why would you want to?

Last edited by tredegar; 04-19-2011 at 10:07 AM.
Old 04-19-2011, 07:37 PM   #5
Registered: Jun 2010
Distribution: Ubuntu, CentOS
Posts: 33

Original Poster
Rep: Reputation: 0
There has been several instances where I will have sevaral files opened in gedit.

My logic is to do the following from the command prompt:
1-Close logfile that was opened with gedit, while keeping other files opened
2-Run script to update the logfile
3-Reopen logfile using gedit

I am only interested with the changes to the logfile. Could there be an easier way the do this, may be using a different file viewer? I am open to suggestions.

Thank you for any help or input.
Old 04-19-2011, 09:54 PM   #6
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288

gedit is for editing files, you seem to just want to view them. Additionally you want to watch the file as it updates. For this purpose "tail -f" would probably be a good choice:

tail -f somefile
Use Ctrl-C in the terminal when you want to stop looking at the file.

1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
What does closing an file descriptor mean? rainman1985_2010 Programming 2 03-13-2011 12:56 PM
FIle browser keeps reopening after closing it immortaltechnique Ubuntu 2 06-19-2010 01:56 AM
Evince closing when I open a particular file ThinkFree Linux - Software 2 08-16-2009 01:11 AM
Where is the bottleneck in file opening and closing dman65 Programming 13 03-05-2009 07:58 AM
Closing file descriptors nikin Linux - Newbie 2 06-05-2008 04:16 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:40 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration