Clear a file without changing its timestamp

Posted by Alex Farber on Stack Overflow See other posts from Stack Overflow or by Alex Farber
Published on 2010-05-27T10:30:20Z Indexed on 2010/05/27 10:41 UTC
Read the original article Hit count: 147

Filed under:
|
|

Is it possible to clear a file preserving its timestamp, using standard Linux commands? For example:

echo "" > file-name

converts the text file to empty, this is OK for me. But I need to keep the timestamp unchanged.

© Stack Overflow or respective owner

Related posts about linux

Related posts about file