O'Reilly logo

LPIC-1/CompTIA Linux+™ Certification All-in-One Exam Guide by Robb Tracy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Editing Text Files in vi

The first time you run vi, you’ll notice right away that its user interface is very different than what you may be used to with other text editors. To familiarize you with vi, we’ll discuss the following topics here:

• Opening files in vi

• vi modes

• Working in insert mode

• Working in command-line mode

• Working in command mode

Opening Files in vi

To open a file from the shell prompt to manipulate in vi, simply enter vi filename. For example, suppose there is a file named myfile.txt in your user’s home directory. If the file resides in the current directory, you can simply enter vi myfile.txt at the shell prompt to load this file into the vi editor. If the file resides in a directory other than the current directory, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required