How to delete all lines in vi or vim editor
Friday, February 10th, 2017
To delete all the lines of the file in vi or vim, makes sure you have your file opened in the command mode (esq) and not the input mode (i). It takes two steps:
- Go to the top of the file by pressing “gg”.
- Press “dG” (notice capital “G”, “d” followed by “Shift+g”).
That’s it. You can now save the empty file with “ZZ”.