Creating empty file

One often faces situation in linux to create an empty file, may it be server side or embedded system. Depending on the environment and the tools available here is the list of way to create empty file.

printf '' > filename
cat /dev/null > filename
touch filename
echo -n > filename
> filename1
truncate -s 0 filename1

Leave a Reply

Your email address will not be published. Required fields are marked *