Creating empty file in Linux

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

Code:

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 *