To clear only the contents of a file (my most used and most favourite one esp with application logs) cat /dev/null > any_file.txt
To clear only the contents of a file (my most used and most favourite one esp with application logs) cat /dev/null > any_file.txt