Home > System Tutorial > Linux > body text

How to delete large files under centos? How to delete large files under centos

WBOY
Release: 2024-01-10 08:25:51
forward
543 people have browsed it

Today I found that the disk space of the test server was 100% used. Through df -lh and du –sh, the jenkins log file 363G is located. I found several methods on the Internet about deleting large files:

1. The lowest: rm

rm After deleting the large file, df –lh will find that the disk is still occupied.

This is because when rm deletes a file, the file is generally not written to the disk immediately, that is, the space is not released immediately.

Solution:

1. Restart the server (it is best not to choose);

2.losf | grep deleted; View deleted processes

How to delete large files under centos? How to delete large files under centos

The process is not closed, so the disk space will not be released. Kill –9 PID is required. The space will not be released until the process is killed.

2. Input redirection:

The following methods all clear the file contents, but they will not delete the file

1. echo >/path/to/somefile

2. cat /dev/null > /path/to/somefile

3. >/path/to/somefile

4 : >/path/to/somefile

The above is the detailed content of How to delete large files under centos? How to delete large files under centos. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!