Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 08-04-2009, 11:08 AM   #1
Senior Member
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Rep: Reputation: 30
root access file edit?

In my root access when I edit a file using vi it opens the file but I have to keep pressing down to get to the bottom.
How do I edit text within the file and the exit/save the file to get back to the command line # ?
Old 08-04-2009, 11:12 AM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,075
Blog Entries: 14

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
vi has many many features.

You can type man vi to get all the information you'll ever want (and more).

However, it is probably better to find a beginner's guide to vi like the one here:

To exit without changing anything if you're already in vi just hit the escape key then type ":q!" and hit return. Review a beginner's guide like the one above then come back to it.
Old 08-04-2009, 11:13 AM   #3
LQ Newbie
Registered: Aug 2009
Location: Netherlands
Distribution: CentOS 5.3
Posts: 27

Rep: Reputation: 15
While in you're vi

To edit:
Type ESC + i

To save + quit:
Type ESC + :wq (enter)
Old 08-04-2009, 12:08 PM   #4
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,899
Blog Entries: 27

Rep: Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186

You could use while in vi;

Esc :help

To go through the help session to learn by example.
Old 08-04-2009, 07:24 PM   #5
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
To save & exit:

ESC :x

shorter than wq
Note that you're almost certainly using vim (vi improved) if you have a std Linux install. They usually symlink the vi cmd to vim.
Please add your distro & version to your profile.

Try typing


at the shell, or go into vi/vim and

ESC :help tutor
Old 08-04-2009, 07:33 PM   #6
Registered: Jul 2009
Distribution: Ubuntu 9.04
Posts: 328

Rep: Reputation: 42
vimtutor was extremely helpful to me when I didn't know anything about vim. It has everything in it you need to know to use it well enough to get by.
vim's very easy to use, once you know the basics.
I personally copied the vimtutor file into my home directory so I could mess around with it without worrying about ruining it or anything like that, but I think it makes a backup of it when you use it, to prevent that from happening. I haven't mastered it or anything, but I can use it very well (by my standards). I stay simple with it, even my .vimrc is simple. I just add
set nocompatible
syntax on
set tabstop=4
set number
I haven't learned much more about it than what's in the vimtutor, though ... except for reading short tutorials on sites. I know learning more about it would be very useful, but once I could comfortably use it, I started reading about other things ...

Last edited by joeBuffer; 08-04-2009 at 07:37 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I edit a file as root in elive? MurX Debian 6 01-01-2009 08:07 AM
How to edit vlc configuration file in root? pattyadams4@bigpond. Linux - Newbie 9 11-14-2008 11:02 AM
How to edit the /etc/passwd file not using root? elthox Linux - Newbie 9 04-10-2008 02:31 AM
Elementary Question - Can't Edit File - Need Root rrrssssss Linux - Newbie 2 04-12-2005 04:05 AM
how to edit a file without logging in as root? osat3ch Fedora 3 08-22-2004 12:16 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:29 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration