Linux to clear space

background:

    When using Linux servers, often encounter disk space on the server is full, in which case, you must clean up disk space.

Solution:

   Example: the need / tmp next available empty space of at least 1G

Run the following command:

  • df / tmp (tmp your query mount points)

     Is visible through the command / tmp is mounted on / below.

  • df -h (see each mount point where the total capacity and available capacity)

    Examples can be seen by / mount point in free space at 242G, for example be sufficient, if it is still would like to free up space, can be operated down.

  •  find mount point -size + 1G (see under the mount point is greater than the size of a file)

    Find example mount point is greater than 500M of files, you can see the file under the opt relatively large, then switch to the opt directory, delete large files

  • rm -rf directory name

    After the delete example, the mount point opt ​​apparent free space becomes larger, but the available space / mount point is not changed, then perform the following operations

  • du -h -x --max-depth=1

   With a look at what the mount point directory, delete the directory for large files, find executed before by ./ -size + 500M found large files in var, then you can delete these large files.

 

If the available capacity is not varied by df -h found, the command can be executed

This command deletes the file before it can be listed which is the process of taking up , directly kill 9 process ID, kill the process, you can free up space.

 

Guess you like

Origin www.cnblogs.com/sandyflower/p/11265869.html