简体   繁体   中英

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

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:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM