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

Notices


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

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, 10:12 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,865
Blog Entries: 14

Rep: Reputation: 1111Reputation: 1111Reputation: 1111Reputation: 1111Reputation: 1111Reputation: 1111Reputation: 1111Reputation: 1111Reputation: 1111
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:
http://www-acs.ucsd.edu/info/vi_tutorial.shtml

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, 10:13 AM   #3
Amy84
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, 11:08 AM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,726
Blog Entries: 27

Rep: Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058
Hi,

You could use while in vi;

Esc :help

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

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
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.
http://www.vim.org/

Try typing

vimtutor

at the shell, or go into vi/vim and

ESC :help tutor
 
Old 08-04-2009, 06:33 PM   #6
joeBuffer
Member
 
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
Code:
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 06:37 PM.
 
  


Reply


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 07:07 AM
How to edit vlc configuration file in root? pattyadams4@bigpond. Linux - Newbie 9 11-14-2008 10:02 AM
How to edit the /etc/passwd file not using root? elthox Linux - Newbie 9 04-10-2008 01:31 AM
Elementary Question - Can't Edit File - Need Root rrrssssss Linux - Newbie 2 04-12-2005 03:05 AM
how to edit a file without logging in as root? osat3ch Fedora 3 08-21-2004 11:16 PM


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

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