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! |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
04-21-2003, 03:50 AM
|
#1
|
|
Member
Registered: Mar 2003
Posts: 404
Rep:
|
how to edit a file when not in X (ie from the command line)
Just wondeing how one can edit a file from the command line,when not in X
I know how to show the contents of the file on the console ( #more filename) but how can I edit and save the changes ?
cheers
Ludwig
|
|
|
|
04-21-2003, 03:53 AM
|
#2
|
|
Moderator
Registered: Nov 2002
Location: Kent, England
Distribution: Lubuntu
Posts: 19,088
|
You need to use a text editor - eg pico /folder/subfolder/filename or vi or whatever your text editor is.
Which file do you need to edit? If it's xf86config to enable your NVidia drivers I found it easier to edit the file first and then to drop into a console to install the driver.
|
|
|
|
04-21-2003, 03:55 AM
|
#3
|
|
Member
Registered: Mar 2003
Posts: 404
Original Poster
Rep:
|
so from the command line,what would I type to edit a file?
I want to edit a file whilst not in X.
Cheers
Ludwig 
Last edited by ludwig W; 04-21-2003 at 03:56 AM.
|
|
|
|
04-21-2003, 03:58 AM
|
#4
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,711
|
he already clearly told you...
Quote:
|
pico /folder/subfolder/filename
|
please pay a little more attention to the advise you are given, thanks
|
|
|
|
04-21-2003, 04:01 AM
|
#5
|
|
Moderator
Registered: Nov 2002
Location: Kent, England
Distribution: Lubuntu
Posts: 19,088
|
You need to use a text editor - eg pico /folder/subfolder/filename or vi or whatever your text editor is.
That is - type in your text editor name folowed by a space followed by the path to the file you wish to edit. Not knowing your system, distro, etc no one can tell you the exact command.
So your steps are:
Identify which text editor you need to use in a console
Identify the path to your folder and the file name
Type it into a console as "editorname /path/to/filename" (minus the quotes)
Edit the file
Save the file
Typing "man your text editor" (minus the quotes) into a console will give you a great deal of info on th editor and the commands you can use.
|
|
|
|
04-21-2003, 04:02 AM
|
#6
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,711
|
fyi, try using "less" instead of "more" it's much more powerful. no really...
|
|
|
|
04-21-2003, 09:31 AM
|
#7
|
|
Member
Registered: Apr 2003
Posts: 625
Rep:
|
Ludwig,I just got my first taste of vi editing fstab so that I could
write to my xp(fat32) partition.
vi <file name>
press ins
edit
esc
shift zz
It took a few trys but I got it done.
|
|
|
|
04-21-2003, 10:01 AM
|
#8
|
|
Member
Registered: Mar 2003
Posts: 404
Original Poster
Rep:
|
thanks XavierP.That's cleared up my confusion.
acid_kewpie:It's not a question of paying more attention.It's a question of understanding.Things that may seem blindingly obvious to you,might well confuse a newbie like me  I'm sorry to be so dumb,but I am new to this and I know my questions must bug some of the more experienced posters here.I can only apologise.
mjolnir: I've also just got the hang of vi.I also have gedit which I can use,I think.
Thanks for all your help,
Ludwig
|
|
|
|
04-21-2003, 09:40 PM
|
#9
|
|
Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018
Rep:
|
Quote:
Originally posted by ludwig W
Things that may seem blindingly obvious to you,might well confuse a newbie like me. I'm sorry to be so dumb,but I am new to this and I know my questions must bug some of the more experienced posters here.I can only apologise.
|
Very true. It's easy to get impatient and forget how confusing some of this stuff was, starting out... all of us were newbies at one point.
Don't feel bad about asking questions! I mean, this is Linux Questions.org... And the more experienced people might be bugged but that's just too bad for them. Most of the people here are very willing to lend an ear and some assistance.
|
|
|
|
04-21-2003, 10:00 PM
|
#10
|
|
Guru
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141
Rep:
|
If you have midnight commander installed (command to run it is mc), it has a nice editor. Navigate to the file and press F4.
midnight commander
|
|
|
|
04-21-2003, 10:05 PM
|
#11
|
|
Guru
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141
Rep:
|
Quote:
Originally posted by acid_kewpie
fyi, try using "less" instead of "more" it's much more powerful. no really...
|
Less is more.
More is less.
Obviously that is true. Trust me. It is really true.
If you don't believe me and acid_kewpie, read the man pages for yourself.
|
|
|
|
04-22-2003, 03:09 AM
|
#12
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,711
|
not always. many distro's do just link it but not all
|
|
|
|
04-22-2003, 04:00 AM
|
#13
|
|
Member
Registered: Mar 2002
Location: ma
Distribution: slackware
Posts: 747
Rep:
|
emacs -nw filename

|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 08:17 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|