Tuesday, December 16, 2014

Shell Scripting : How to truncate a file to zero length, without changing permissions?

To truncate a file to zero length without changing permissions, here are the options

1) cp /dev/null file.xxx
2) : > file.xxx

In the second option involving colon(:), the : being a shell built-in command, no new process is forked.

No comments:

Post a Comment