LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to perform simple editing of a file (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-perform-simple-editing-of-a-file-328295/)

kos147 05-29-2005 02:07 PM

how to perform simple editing of a file
 
When my machine boots, a list of operating systems is provided and I choose which one I want to use. If I don't select anything then linux loads by default.

I want to change this so that windows loads by default. Through the help of these forums I know I need to change:

/etc/lilo.conf as root

then run

/sbin/lilo to effect the changes.

I was given a link to http://www.linuxcommand.org/ for further info. I have now read this site and it has been an excellect source for getting to know the shell. But it has not provided any info on how to edit a file and save. Could somoene please explain how to do the above steps?

Also what was meant in the above by then run /sbin/lilo to effect the changes.

david_ross 05-29-2005 02:13 PM

For editing a file - see vi:
http://www.collaborium.org/onsite/ve...nux_guides/vi/

For running /sbin/lilo - just type it as a prompt as root and press enter.

ethics 05-29-2005 02:18 PM

Never used vi but i find emacs pretty good

emacs <path to file> then will open in an editor similar to windows notepad

PTrenholme 05-29-2005 02:34 PM

Or, even easier, try XEmacs if you have it. It's a nice X-windows shell for Emacs, and easier to use for new users. You didn't mention your release, so I can't suggest how you'd get XEmacs. You'd probably do something like "yum install xemacs" or "apt-get xemacs."

Tinkster 05-29-2005 03:22 PM

Quote:

Originally posted by PTrenholme
Or, even easier, try XEmacs if you have it. It's a nice X-windows shell for Emacs, and easier to use for new users. You didn't mention your release, so I can't suggest how you'd get XEmacs. You'd probably do something like "yum install xemacs" or "apt-get xemacs."
Are you aware of the fact that the "normal" emacs has a GUI
frontend, too? No need to install xemacs which exclusively
runs in X ...



Cheers,
Tink

naimslim89 05-29-2005 04:37 PM

Use vi. Nice, quick and easy. No GUI (X) needed.

To open a file:

$ vi your_file_name

To edit the file: Press I.

Then navigate through the file normally and make any changes.

When complete, press ESC once.

Then, type ":wq" to save and quit.

Done.

rickh 05-29-2005 06:53 PM

Quote:

$ vi your_file_name
To edit the file: Press i.
Then navigate through the file normally and make any changes.
When complete, press ESC once.
That may be oversimplifying it a bit. On any vi I've used, you had to hit ESC everytime you wanted to move to another line ... then i again to edit that line. ... vim works as you describe.

That being said, kos147, ... Do extend the effort to gain at least rudimentary skills with vi ... once you begin to get comfortable with it switch to vim, and don't use the GUI's until you're comfortable using them in the shell. vi is different, but it's not really hard ... and it's ubiquitous on Unix type systems.

If I want to use a GUI editor, I prefer nedit ... but for things like a quick edit of your lilo.conf files, vi is the right tool. A big part of becoming proficient any any endeavor is learning the use of the right tool for the task at hand.

Also, when you're through editing {SHIFT} ZZ works just like :wq ... If you mess it up and want to start over ... :q!

kos147 05-29-2005 07:53 PM

Thanks for the advice everyone.

I think I will start to learn how to use VI.

In the meantime in order to make the required change is it ok to editi this file using KWrite.

Also could someone give me the command to run lilo and also which dir I should be in.

Thanks

Tinkster 05-29-2005 07:55 PM

Quote:

Originally posted by kos147
Thanks for the advice everyone.

I think I will start to learn how to use VI.

In the meantime in order to make the required change is it ok to editi this file using KWrite.

Also could someone give me the command to run lilo and also which dir I should be in.

Thanks

The command to run lilo is lilo, and can be issued from anywhere
as long as you're root and it's in your path ;)


Cheers,
Tink

kos147 05-29-2005 08:14 PM

ok tried to use vi to edit the file it says it is a read only file and I need to use ! - what dos this mean?

Also the last post says:

The command to run lilo is lilo, and can be issued from anywhere
as long as you're root and it's in your path ;)

what does this mean - as long as you're root? and its in my path?

kos147 05-29-2005 08:31 PM

ok using: ls - l lilo.conf

I can see that the root user can read and write.
irm
and the root group can only read.

I assume because I cannot save ny chnages that I am not root user. Is there a way of confirming this?

Also how do I now modify the file?

pjbii 05-29-2005 08:41 PM

pico is easy, nano on some i think

JunctaJuvant 05-29-2005 08:54 PM

Quote:

Originally posted by kos147

I assume because I cannot save ny chnages that I am not root user. Is there a way of confirming this?

Also how do I now modify the file?

Type "whoami" on the command line. If it says anything other than "root" (and it probably will), you need to issue the command "su" followed by your root password. Then you may edit lilo.conf in your favorite editor.

gnukish 05-29-2005 10:53 PM

beginner friendly ?? did u say that ?? Vim and Vi are what u said. Emacs is a bit tough to use than vi

mjjzf 05-30-2005 04:57 AM

I always preferred Nano - extremely straightforward, beginner-friendly - but I have started using Vim exclusively, and I think I'll stick with that.


All times are GMT -5. The time now is 05:33 AM.