Fast Ways to Empty a File on Linux
A quick reference to shell redirection and utilities that clear file contents without removing the file itself.
Fast ways to empty a file
echo "" > filenameecho /dev/null > filenameecho > filenamecat /dev/null > filename: > filename # `:` is a placeholder and produces no output.> filename