![Emptying a file on a GNU/Linux terminal.](https://miguelmenendez.pro/en/blog/2010/emptying-file-gnu-linux-terminal/error-log-0-bytes.jpg)
Emptying a file on a GNU/Linux terminal
Sometimes it is necessary to empty plain text files quickly and without complications from the command line on a local machine or remotely via SSH.
As fast and intuitive (although, if we’re not careful, dangerous):
~$ > file-name
For example, to clear a error log file after having solved all the problems that generated it:
~# > /var/log/apache/error.log
There are also other methods:
~$ cat /dev/null > file-name
or
~$ echo "" > file-name