user19140477031
user19140477031

Reputation: 363

File contents not deleted in linux centos

I have the program running using this command

command 2> sample.txt

now that file is growing continuously and command will exit in 5-6 days and i beleive that file size won't go in GB

I tried this

echo "" > sample.txt but thats not making any differnce to it and filesize is growing.

i was thinking of setting up cron job after 1 hour to empty its contents

How can i empty the contents of file

Upvotes: 0

Views: 100

Answers (1)

R Kaja Mohideen
R Kaja Mohideen

Reputation: 917

Try the following command, this will write the console output to a file. (Your console will also get the messages printed).

command | tee -a file.log

and you can empty the contents by

> file.log

Upvotes: 1

Related Questions