How to empty or clear the contents of an existing UNIX file ?
The special file /dev/null can and does contain nothing. While most often used as a sink of nothingness, for example writing output to it that you don’t want to keep, it can be used as a source of nothingness, too. To replace the contents of the file XYZ.txt with nothing, you can use the command cat /dev/null > XYZ.txt This command makes sense as it is using standard UNIX redirection to place the contents of one file (a known empty one) to another file.
Related Questions
- The history file doesn have any effect on the Location or Netsite pulldown menu at the top of your browser window. To find out how to clear that, please see How do I clear the Location (Netsite) pulldown menu?
- How can I append the contents of File A into an existing and loaded File B?
- What are the limitations of UNIX file support?