Today to see the alarm server alarm, found/var/log/messages file size of 3.9GB, to save space to decide to empty the messages file. Because this file cannot be deleted directly, consider using the following command
echo "" >/var/log/messages result error is as follows
-bash:/var/log/messages:operation not permitted
Use Ll/var/log/messages to view permissions displayed as 600 and the current user is root
Llattr/var/log/messages is displayed as-----a-------e-messages originally has a permission, the meaning of a permission is only allowed Append, not allowed to delete.
The solution is chattr-a/var/log/messages This time the permission is-------------e-messages
Then use echo "" >/var/log/messages to execute successfully
The view messages is completely emptied at this time.
This article comes from "If technology can be made into art!" "Blog, be sure to keep this provenance http://jesus110.blog.51cto.com/376008/1655044
Messages cannot be deleted under Linux