What is the command to empty an already existing file.
please provide me.i used Touch cmd to empty the file.but it changing the time only.
What is the command to empty an already existing file.
please provide me.i used Touch cmd to empty the file.but it changing the time only.
> file
or
: > file
i need to empty a file which is already existing.
cat </dev/null >file
The command works also for an existing file :
$ ls -l my_file
-rw-r--r-- 1 Jean-Pierre Aucun 8943 Jul 4 18:55 my_file
$ > my_file
$ ls -l my_file
-rw-r--r-- 1 Jean-Pierre Aucun 0 Jul 4 18:56 my_file
$