X

Delete all lines in VI editor

Follow the below steps to delete all the lines in a file (emptying file) using VI / VIM editor. Open the file vi <file-name> Press gg, this will move the cursor to the first line of the file. Now press dG, this deletes all the lines. Finally, type :wq to save the changes and exit from the…

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!!

Shravan Kumar Kasagoni: