April 20, 2015, 08:32:32 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
Author Topic: HOWTO: Edit a file  (Read 1063 times)
Posts: 57

« on: July 18, 2012, 05:50:28 am »

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 Smiley

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...

VL 7.0 Light - Barebones Install - Kernel 3.0.17
Debian Testing - Minimal Install - kernel 3.4.0-6.dmz.1-liquorix-686
Desktop: Atom Processor || 1 GB RAM || 500 GB HD
Posts: 1279

« Reply #1 on: July 18, 2012, 06:22:24 am »

Vector Linux defaults to mcedit, which is far nicer IMO than nano.

ASUS K73 Intel i3 Dual Core 2.3GHz
Posts: 57

« Reply #2 on: July 18, 2012, 07:14:37 am »

Probably, i must confess i've never used mcedit, the object of this writing is to introduce new users to file editing, thank you for the suggestion. Now i will install it, 'cause i try to launch it, but i ain't got it (light install and all), thanks for the contribution. I spent Sunday playing with vi/vim Smiley

PS: you were right, it's already there, i tried it on .xinitrc and it worked, console and everything. something learned today Smiley
« Last Edit: July 18, 2012, 07:31:12 am by macondo » Logged

VL 7.0 Light - Barebones Install - Kernel 3.0.17
Debian Testing - Minimal Install - kernel 3.4.0-6.dmz.1-liquorix-686
Desktop: Atom Processor || 1 GB RAM || 500 GB HD
Pages: [1]
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!