Empty a log file in Linux

I needed to empty a log file on one of my Linux boxes today as it had grown to 7.5 GB in size. This was achieved by simply running the following command in the directory where the problem file exists, and LOG_FILE was the name of the file to be emptied:

cat /dev/null > LOG_FILE

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: