การใช้งาน vi editor บน unix
DESCRIPTION
How to used VI on Unix - Thai LangTRANSCRIPT
-
Articles Comments
Oracle DBA & All IToracle database pl/sql sql DBA script, unix, shell script, Tips IT, Programming
Home
Oracle DBA & All IT Programming, Unix vi editor unix
vi editor unixMay 2nd, 2011 | 10 Comments
Vi (What is vi?)Vi (visual editor) editor Unix editor UNIX vi editor 2 :Command mode 1. Insert mode (Escape) insert
2.
NOTE:
UNIX vi case-sensitive. ()
vi (Start vi) vi
* vi filename edit filename starting at line 1
vi -r filename recover filename that was being edited when system crashed
vi editor unix | Oracle DBA & All IT http://oracle.jookku.com/2011/05/vi/
1 of 13 4/8/2014 6:37 AM
-
vi (Exit vi) vi Note: (:) cursor (or )
* quit vi, writing out modified file to file named in original invocation
:wq quit vi, writing out modified file to file named in original invocation
:q quit (or exit) vi
* :q! quit vi even though latest changes have not been saved for this vi call
cursor vi (Moving the Cursor) vi mouse cursor pc l ^
*j or [or down-arrow] move cursor down one line
* k [or up-arrow] move cursor up one line
*h or [or left-arrow] move cursor left one character
vi editor unix | Oracle DBA & All IT http://oracle.jookku.com/2011/05/vi/
2 of 13 4/8/2014 6:37 AM
-
*l or [or right-arrow] move cursor right one character
* 0 (zero) move cursor to start of current line (the one with the cursor)
* $ move cursor to end of current line
w move cursor to beginning of next word
b move cursor back to beginning of preceding word
:0 or 1G move cursor to first line in file
:n or nG move cursor to line n
:$ or G move cursor to last line in file
(Screen Manipulation)
^f move forward one screen
^b move backward one screen
^d move down (forward) one half screen
^u move up (back) one half screen
^l redraws the screen
vi editor unix | Oracle DBA & All IT http://oracle.jookku.com/2011/05/vi/
3 of 13 4/8/2014 6:37 AM
-
^r redraws the screen, removing deleted lines
, (Adding, Changing, and Deleting Text) 1 step
* u UNDO WHATEVER YOU JUST DID; a simple toggle
(Inserting or Adding Text) insert insert
* i insert text before cursor, until hit
I insert text at beginning of current line, until hit
* a append text after cursor, until hit
A append text to end of current line, until hit
* o open and put text in a new line below current line, until hit
* O open and put text in a new line above current line, until hit
vi editor unix | Oracle DBA & All IT http://oracle.jookku.com/2011/05/vi/
4 of 13 4/8/2014 6:37 AM
-
(Changing Text)
* r replace single character under cursor (no needed)
R replace characters, starting with current cursor position, until hit
cwchange the current word with new text,starting with the character under cursor, until hit
cNw change N words beginning with character under cursor, until hit; e.g., c5w changes 5 words
C change (replace) the characters in the current line, until hit
cc change (replace) the entire current line, stopping when is hit
Ncc or cNc change (replace) the next N lines, starting with the current line,stopping when is hit
(Deleting Text)
* x delete single character under cursor
Nx delete N characters, starting with character under cursor
vi editor unix | Oracle DBA & All IT http://oracle.jookku.com/2011/05/vi/
5 of 13 4/8/2014 6:37 AM
-
dw delete the single word beginning with character under cursor
dNw delete N words beginning with character under cursor; e.g., d5w deletes 5 words
D delete the remainder of the line, starting with current cursor position
* dd delete entire current line
Ndd or dNd delete N lines, beginning with the current line; e.g., 5dd deletes 5 lines
(Cutting and Pasting Text)
yy copy (yank, cut) the current line into the buffer
Nyy or yNy copy (yank, cut) the next N lines, including the current line, into the buffer
p put (paste) the line(s) in the buffer into the text after the current line
(Other Commands) (Searching Text)
vi editor unix | Oracle DBA & All IT http://oracle.jookku.com/2011/05/vi/
6 of 13 4/8/2014 6:37 AM
-
/string search forward for occurrence of string in text
?string search backward for occurrence of string in text
n move to next occurrence of search string
N move to next occurrence of search string in opposite direction
(Determining Line Numbers) ,
:.= returns line number of current line at bottom of screen
:= returns the total number of lines at bottom of screen
^g provides the current line number, along with the total number of lines,in the file at the bottom of the screen
(Saving and Reading Files)
:r filename read file named filename and insert after current line(the line with cursor)
:w write current contents to file named in original vi call
vi editor unix | Oracle DBA & All IT http://oracle.jookku.com/2011/05/vi/
7 of 13 4/8/2014 6:37 AM
-
:w newfile write current contents to a new file named newfile
:12,35w smallfile write the contents of the lines numbered 12 through 35 to a new file namedsmallfile
:w! prevfile write current contents over a pre-existing file named prevfile
.. Preview : 7245
Related Search:
vi editor vivi mode vivi unixvi editorunix command direction vi unix unix
vi editor unix | Oracle DBA & All IT http://oracle.jookku.com/2011/05/vi/
8 of 13 4/8/2014 6:37 AM
-
Written by DBAor
" " -- forum --Visit DBAor's Website
Filed under: Programming, Unix Tags: command line, editor, linux, sun, unix, vi, visual editor
10 Responses to " vi editor unix"
Mozelle says:May 4, 2011 at 20:57
Added, I enjoy your site! Reply
Luella says:1.
1.
vi editor unix | Oracle DBA & All IT http://oracle.jookku.com/2011/05/vi/
9 of 13 4/8/2014 6:37 AM
-
August 9, 2011 at 13:26
Never seen a beettr post! ICOCBW
Reply
Agatha says:August 9, 2011 at 22:39
Times are changing for the better if I can get this onilne!
Reply
2.
Wesc Oboe Schwarz says:July 7, 2011 at 02:58
Super information! I have been previously seeking something like this for a long time now. Thankyou!
Reply
Bubba says:August 9, 2011 at 02:09
Just cause its silmpe doesnt mean its not super helpful.
Reply
1.
Jenn says:August 9, 2011 at 22:26
Wow! Thats a really neat anwser!
Reply
2.
2.
Wava says:July 7, 2011 at 03:11
Bookmarked, I enjoy your blog! Reply
Lilly says:August 8, 2011 at 20:11
Thank God! Someone with brains spkeas!
Reply
1.
3.
Lorren says:August 8, 2011 at 23:41
You relaly found a way to make this whole process easier.
Reply
4.
vi editor unix | Oracle DBA & All IT http://oracle.jookku.com/2011/05/vi/
10 of 13 4/8/2014 6:37 AM
-
body p
Katherine says:August 9, 2011 at 20:36
Your article was excellent and eruitde.
Reply
5.
Leave a Reply
Name *
Email * (will not be published)
Website
You may use these HTML tags and attributes:
Categories
DatabaseOracle
DBAFunctionNew FeatureORA-ErrorOracle TipsTuning PerformanceUtilities Script
DBADeveloper
DownloadProgrammingUnix
Archives
vi editor unix | Oracle DBA & All IT http://oracle.jookku.com/2011/05/vi/
11 of 13 4/8/2014 6:37 AM
-
February 2014September 2012August 2012March 2012January 2012September 2011August 2011July 2011June 2011May 2011April 2011March 2011
Blogroll
DocumentationPluginsSuggest IdeasSupport ForumThemesWordPress BlogWordPress Planet
Like Box
DBAor
156 people like DBAor.
Facebook social plugin
LikeLike
- Facebook Members WordPress Plugin
Most commented
Hint Tuning Performance (Oracle SQL Hints Tuning) Outline statement index Oracle DBA Responsibilities & SkillsFixing Corrupt System Managed Undo Segments ORA-00600:[6006], [1], .. Program user Kill ORA-06512 DBSNMP.BSLN_INTERNAL
vi editor unix | Oracle DBA & All IT http://oracle.jookku.com/2011/05/vi/
12 of 13 4/8/2014 6:37 AM
-
Cover WP Theme
Recent Articles
ORA-20000:ORU-10027:buffer overflow, limit 50000 bytesSQL*Loader DATE Format -3Sequences (Autonumber) on OracleRole and Privilege on oracle oracle ^^Synonyms ?? update column key partition (ORA-14402)
Tag Cloud
0 rows 11.2.0.1 11g alter system BUG:1828996 commit ctl DEFERRED_SEGMENT_CREATION delete EXP-00008 EXP-00083export force index from function grant index insert linux Load text in table load text into table ORA-06550 oracleoracle11g outline par partition pl/sql pl/sql developer PLS-00201 rollback select sql SQL*Loader sql*plussqlldr sql loader table tablespace tune plan tuning tuning preformance unix update Utilities
2014 Oracle DBA & All IT
vi editor unix | Oracle DBA & All IT http://oracle.jookku.com/2011/05/vi/
13 of 13 4/8/2014 6:37 AM