Shravan Kumar Kasagoni

Skip Navigation
Delete all lines in VI editor

Delete all lines in VI editor

 /  Leave a response

Follow the below steps to delete all the lines in a file (emptying file) using VI / VIM editor.

  1. Open the file vi <file-name>
  2. Press gg, this will move the cursor to the first line of the file.
  3. Now press dG, this deletes all the lines.
  4. Finally, type :wq to save the changes and exit from the file.

Happy Coding!!

Write a response

Your email address will not be published. Required fields are marked *

All code will be displayed literally.

Close Bitnami banner
Bitnami