Most efficient method to empty the contents of a file
292
votes
3
answers
477869
views
I am aware of three methods to delete all entries from a file.
They are
-
>filename
- touch filename
1
- filename filename
the most as that requires the least number of keystrokes.
However, I would like to know which is the most efficient of the three (if there are any more efficient methods) with respect to large log files and small files.
Also, how does the three codes operate and delete the contents?
----
1**Edit**: as discussed in [this answer](https://unix.stackexchange.com/a/88810/377345) , this actually _does not_ clear the file!
Asked by debal
(3754 rep)
Aug 30, 2013, 05:13 AM
Last activity: Feb 25, 2021, 02:26 PM
Last activity: Feb 25, 2021, 02:26 PM