Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Linux/Empty A File

December 21, 2017

Empty A File

If you work with vi, nano or any other command line editor, deleting a line is a fairly easy thing to do. If the file is too large, deleting the content line by line is not fun. There’s a better way to empty a file without deleting it. Here are several ways.

$ > filename
$ truncate -s 0 filename
$ echo "" > filename

$ > filename $ truncate -s 0 filename $ echo "" > filename

Filed Under: Linux

Have content delivered to your mail. Subscribe below.

About Me

I'm Ulysses, Cloud Engineer at Cardinal Health based in Columbus. This blog is about Linux and Cloud technology. When off the grid, I enjoy riding my electric skateboard. I've surfed, snowboarded and played the saxophone in the past. I hope you find this website helpful. It's powered by WordPress and hosted on AWS LightSail.

  • Cloud
  • Linux
  • Git

Copyright © 2012–2021