How do I remove all lines from a file in Linux?

How do I remove all lines from a file in Linux?
Answer
Delete all lines in VI / VIM editor – Unix / Linux
  1. Go to command mode in the editor by pressing ESC key on the keyboard.
  2. Press gg. It will take to the first line of the file.
  3. Then press dG. This will delete from the first line to the last line.
 

Tìm kiếm

Back
Top