how to delete all lines in a file using VI

 

  • Make sure you are in the command mode in Vim by pressing the Esc key.
  • You need to be at the beginning of the file. Press gg for that. This means pressing the g key in quick succession.
  • Now press dG. This means pressing the key d and then hold Shift and press g. Yes, G is uppercase and you'll have to use shift key here the same way you type G.

In short: Esc+gg+dG is what you need to do for deleting all the lines of the file in Vim.

No comments:

Post a Comment

Selenium firefox driver session fails with : Could not start a new session. Response code 500. Message: Expected browser binary location, but unable to find binary in default location,

 Error: With Firefox driver /gecko driver Could not start a new session. Response code 500. Message: Expected browser binary location, but u...