Difference between revisions of "Training/Linux - vi editor"

From HPC
Jump to: navigation , search
(Created page with "== Introduction == Linux has a large number of editors available to it which will match their preferences. The vi editor is installed on almost every Linux. Linux will very o...")
 
m
Line 10: Line 10:
 
<pre style="background-color: black; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 
<pre style="background-color: black; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
  
[username@viper ~]$ vi   (just start vi)
+
[username@viper ~]$ vi                     (just start vi)
 
[username@viper ~]$ vi newfile.c    (start vi with a new file called newfile.c)
 
[username@viper ~]$ vi newfile.c    (start vi with a new file called newfile.c)
 
[username@viper ~]$ vi existing.c  (start vi with an existing file called existing.c)
 
[username@viper ~]$ vi existing.c  (start vi with an existing file called existing.c)

Revision as of 10:13, 28 February 2017

Introduction

Linux has a large number of editors available to it which will match their preferences. The vi editor is installed on almost every Linux. Linux will very often install vim (vi improved) which is similar. Every command line user should know vi(m), because it is an easy tool to solve problems.

The vi editor is not intuitive, but once you get to know it, vi becomes a very powerful application.

Below is a few examples on the command line of how to invoke vi.



[username@viper ~]$ vi                      (just start vi)
[username@viper ~]$ vi newfile.c    (start vi with a new file called newfile.c)
[username@viper ~]$ vi existing.c   (start vi with an existing file called existing.c)
[username@viper ~]$ vi existing1.c existing2.c  (start vi with a multiple files listed)