'How to empty the file content in vi editor
I have a log file on a server called log.txt
which has many lines. I open the file using the vi
editor, and I want to empty the file content in command line mode of the vi
editor. What's the key combination? please help me. Thank you!!!
Solution 1:[1]
First come out front input mode by pressing ESC
key then apply gg
to go to first line and then type dG
to delete everything .after that save the file with :w
command that way you will have a blank file :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Shashi |