Opening a File in vi

team bbl


vi is a command-line editor, for use in a terminal window. To open a file in vi, type:

 vi testfile 

testfile is the filename. In Figure 18-2, testfile doesn't exist, so a new file is opened.

Figure 18-2. vi text editor.


The tildes represent lines that don't exist in the file. As you insert text into the file, the tildes disappear. The filename is shown below the open file.

Most Linux distributions provide vim as the major text editor. vim is an advanced version of vi. In most cases, you should use vim. For many distributions, the vi command actually opens vim. If it doesn't, you can type:

 vim testfile 

The commands described in this chapter work equally well in vi or vim.

    team bbl



    Spring Into Linux
    Spring Into Linux
    ISBN: 0131853546
    EAN: 2147483647
    Year: 2005
    Pages: 362
    Authors: Janet Valade

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net