LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   edit a file (https://www.linuxquestions.org/questions/linux-newbie-8/edit-a-file-136481/)

mjewell 01-19-2004 04:44 PM

edit a file
 
To solve a problem with a sound driver, I'm told I need to uncomment a particular driver in a particular rc file. Imagine my embarassment when I realize that I don't know how to edit a file.

I used cd to change to the right directory and cat to display the info in the file I wanted to edit. . . . Than I was stuck.

All I want to do is change what is written in the file and then exit the file with my changes saved. Its dawning on me that there may be a command I'm supposed to be using because changing this one rc file may require changes elsewhere??? Anyway, as usual, I'm stuck.

Pcghost 01-19-2004 04:48 PM

Depending on the editor you want to use it is as simple as

emacs filename

or

vi filename

or even

kwrite filename.

Type man emacs or man vi for help using the editors.

pgreenwood 01-19-2004 04:53 PM

Re: edit a file
 
Quote:

Originally posted by mjewell
All I want to do is change what is written in the file and then exit the file with my changes saved. Its dawning on me that there may be a command I'm supposed to be using because changing this one rc file may require changes elsewhere??? Anyway, as usual, I'm stuck.
Focusing only on the "edit file" piece of your question, my editor of choice in most cases is midnight commander. If installed on your machine the command is:

~$ mc

or

~# mc

depending upon whether you need root privileges to modify the file.

With mc running, navigate to the chosen file, then touch F4 to open in edit mode. Save changes with F2.

Modify your configuration (F9 I think) to include "lynx-like" navigation, then you can navigate between directories with arrows as well as the Enter key.

mjewell 01-19-2004 04:53 PM

I feel dumb but thanks. I'm going to try it now . . . .


All times are GMT -5. The time now is 04:50 AM.