Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

6.2.2.2. Basic operations

These are some popular vi commands:

  • n dd will delete n lines starting from the current cursor position.

  • n dw will delete n words at the right side of the cursor.

  • x will delete the character on which the cursor is positioned

  • :n moves to line n of the file.

  • :w will save (write) the file

  • :q will exit the editor.

  • :q! forces the exit when you want to quit a file containing unsaved changes.

  • :wq will save and exit

  • :w newfile will save the text to newfile.

  • :wq! overrides read-only permission (if you have the permission to override permissions, for instance when you are using the root account.

  • /astring will search the string in the file and position the cursor on the first match below its position.

  • / will perform the same search again, moving the cursor to the next match.

  • :1, $s/word/anotherword/g will replace word with anotherword throughout the file.

  • yy will copy a block of text.

  • n p will paste it n times.

  • :recover will recover a file after an unexpected interruption.

Introducing Linux
Previous Page Home Next Page

 
 
  Published under the terms of the GNU General Public License Design by Interspire