Clean up a file
echo -n > logfile
- the
-n
flag instructsecho
command not to append a new line.
cat /dev/null > logfile
- the
:
character is a null command.
: > logfile
sudo sh -c ': > logfile'
: | tee logfile
: | sudo tee logfile
> logfile
sudo sh -c '> logfile'
truncate -s 0 logfile