This article introduces a method to empty a file using Bash commands in the Linux command line language. There are various other methods, but Iโd like to introduce the following method as itโs the most interesting, professional-looking, easy to write, and the one I actually use.
> filename.txt
Reference:
linux - How to clear the contents of a file from the command line? - Super User