Monday, April 29, 2024
207
rated 0 times [  207] [ 0]  / answers: 1 / hits: 238093  / 1 Year ago, thu, march 2, 2023, 6:18:57

How to clear text that existed in a text file without opening it?



I mean for example I have a file as hello.txt with some text data in it, and how can I clear the total text in that file without opening it?



By this, I mean not using any editor like nano, Gedit, etc.


More From » command-line

 Answers
4

Just open your terminal with CTRL+ALT+Tand type as



 > hello.txt


that's it, your data in that file will be cleared with out opening it even .



Example:



enter image description here


[#27995] Friday, March 3, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
suitman

Total Points: 487
Total Questions: 105
Total Answers: 98

Location: India
Member since Wed, Aug 4, 2021
3 Years ago
;