How to empty file without delete/recreate or VI

This is simpler way to empty a file in bash, few options for you to choose:

Option 1:
bash# cat /dev/null > [filename]

Option 2:
bash# > [filename]

Option 3:
bash# echo -n > [filename]

Option 4:
bash# cat > [filename]
and then Press Ctrl -D

0 comments: