• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

linux shell: emptying a file

zimu

Diamond Member
right now i do

rm -f filename.txt
touch filename.txt

is there some easier command that essentially "nullifies" a file?

 
Originally posted by: Nothinman
Or just '> file' and skip the cat invocation.
Teh Winnar!

That is the quickest and easiest way to do it.

It works because the ">" stands for "redirect your input to whatevers to whatever medium is to the right of the >. Because there is a single > vs a double >>, it will overwrite the file starting at the top."

There is nothing before the >.
This means you are effectivly overwriting the file with 0 bytes, a la nothing.
 
Back
Top