Messages cannot be deleted under Linux

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.