HOWTO: Edit a file
When i started with Linux, i couldn't figure out the importance of editors and this file editing thing.
I found the hard way how important it is and the consequences of not knowing how to change things in files that control
the functioning of the OS. Thus, i dedicate this mini-howto to all newbies and the unwashed masses out there
WHO DOES WHAT:
The user is allowed to edit the files that "belong to him", i.e. files in his /home, or files he created, files that start
with a period (dot files) e.g. .ratpoisonrc . Ok? nothing else.
The rest of the files in the system belong to ROOT.
There are tons of editors, some gui and some that work from the console/terminal.
Start with the terminal ones, if you are stuck and cannot get into the X system, you can work from the console and enter the X.
If you only know gui editing you are in deep doodoo.
Don't confuse the console and the terminal, the console is that black hole before you enter the X system.
Say you want to edit the .xinitrc file that controls the launching of apps and the entering to the X system.
You notice is a dot file (starts with a dot), are you with me? so, right away you know you can edit it as a user ($)
$ nano .xinitrc
By now you have googled 'nano', you know how to save, exit, move from the beginning of a line, go to the end, etc.
Same with 'vim', go with nano first and then learn vim, it is very important to learn both and then choose the one you like best.
I don't program, code or do any of that, i use both.
Do you want to edit the /etc/inittab file? Is it a dot file, is it in your /home? no? Then ROOT comes to action:
$ su <Enter>
type your root password
and you become root:
# nano /etc/inittab
If you want the changes you have done by editing to stick, you have to save and exit:
Ctrl + o will save the file
Ctrl + x will exit the program
Press the Esc key
this will do both, save/exit
I'm getting old, this is all i remember...