Share your knowledge at the LQ Wiki.
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 03-07-2010, 03:45 PM   #1
LQ Newbie
Registered: Feb 2010
Posts: 9
Blog Entries: 3

Rep: Reputation: 0
opening files in text editor from the terminal

I'm sure this is a really obvious answer, but...

using ubuntu 9.10

If I'm in a terminal window, and I open a file by typing eg :
sudo gedit /usr/share/mydms/index.php

it opens as a blank document... I know it has text in it though!

I've tried with other files and also with nano so it's not just a problem with a particular file (although I'm not ruling out a problem with me being thick...)

How do I view the current contents of the file so I can then edit it?

Many thanks,

Old 03-07-2010, 03:50 PM   #2
Senior Member
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 249Reputation: 249Reputation: 249
What does
ls -l /usr/share/mydms/index.php

give you ?
Old 03-08-2010, 08:09 AM   #3
LQ Newbie
Registered: Feb 2010
Posts: 9
Blog Entries: 3

Original Poster
Rep: Reputation: 0
-rw-r--r-- 1 root root 1135 2008-06-18 00:51 /usr/share/mydms/index.php

and it works today, so goodness knows what I did differently yesterday several times...

Old 03-08-2010, 01:07 PM   #4
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,039

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
goodness knows what I did differently yesterday several times...
You can easily find out (if you are sufficiently interested) by typing history in a terminal.
It'll give you the last 500 or so commands you issued.
I expect you'll notice a spelling mistake in an earlier line that refers to /usr/share/mydms/index.php

An editor that is asked to open a file that does not exist (perhaps by virtue of a mis-type) will open an empty file, assuming that that is what you wanted (quite sensible default behaviour).
Old 03-08-2010, 03:51 PM   #5
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 13,259

Rep: Reputation: 1289Reputation: 1289Reputation: 1289Reputation: 1289Reputation: 1289Reputation: 1289Reputation: 1289Reputation: 1289Reputation: 1289
Which is why tab completion is so handy ...


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
Whats your favorite terminal text editor??? Necronomicom Linux - Software 8 12-16-2011 06:45 AM
text editor is not opening up: modified custom command vanna Linux - Newbie 2 03-10-2009 10:57 PM
Text editor capable of opening Images. ////// Programming 5 11-07-2006 10:37 AM
How do I open a text editor in a shell terminal? alex1986 Linux - Newbie 9 11-30-2005 03:52 PM
Opening text files Nicksan Linux - Software 6 06-29-2003 03:06 AM

All times are GMT -5. The time now is 12:56 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