when you're working on Linux there are plenty of log files, some of them grow really big after a while (especially the logs for apps you installed by hand, they don't use any log rotation in many cases).
usually you download the logs and analyze/store them, and to save space it would be the best to empty the old log file, right?
I use the vi editor, but there is no way to flush the whole content of a file, you can only delete lines, like:
Code: Select all
1000dd
but yesterday I found a nice solution, seems it was too easy to discover it earlier..
let's say the logfile is named some_log, you can flush the whole content simply by:
Code: Select all
> some_log
and voila: file is nice and clean again...