Do all this from the command line or terminal.
This will create a new file named t whose contents is the word "test":
$] echo "test" > tmore will display the contents of the file:
$] more ttestHere's the new trick I learned.
cat reads the contents of
/dev/null (which contains nothing) and
> writes this into
t$] cat /dev/null > tNow
t contains nothing:
$] more tGet rid of it (don't do this to your logfile)
$] rm t
Another command :
$] > file.txt
$]echo > something.txt
$]echo "" > something.txt
for windows:
$]copy con > file.txt
$]copy nul > file.txt