linux磁盘空间_如何检查Linux磁盘空间?

本文介绍了在Linux系统中如何有效地管理和监控磁盘空间。主要内容包括使用df命令查看磁盘使用情况,利用du命令检查文件及目录占用的空间,以及如何通过SSH远程执行这些命令来检查远程服务器的磁盘空间。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

linux磁盘空间

linux磁盘空间

Disk usage and monitoring is important aspect of Linux system administration. One of the most occurring problems is fulling disk space. Getting information about disk usage can become a nightmare if you do not know how to properly do it. How many free GB are there? or How many percentages of the disk is full?

磁盘使用和监视是Linux系统管理的重要方面。 发生最多的问题之一是磁盘空间已满。 如果您不知道如何正确使用磁盘,则获取有关磁盘使用情况的信息可能会成为噩梦。 有多少可用GB? 或多少百分比的磁盘已满?

用df命令检查 (Check with df Command)

To check disk space usage df command can be used. df command will give general information about disk usage. We will also provide the -l and -h options in order to list partitions in a human-readable format.

要检查磁盘空间使用情况,可以使用df命令。 df命令将提供有关磁盘使用情况的常规信息。 我们还将提供-l-h选项,以便以人类可读的格式列出分区。

$ df -lh
Check with df Command
Check with df Command
用df命令检查

We will get the following information about the disk space and size.

我们将获得有关磁盘空间和大小的以下信息。

  • `Size` is the complete size of the given partition or disk.

    “大小”是给定分区或磁盘的完整大小。
  • `Used` is the size which is already used or filled in a given disk or partition.

    “已使用”是给定的磁盘或分区中已使用或已填充的大小。
  • `Available` is the size which is spare in a given disk or partition.

    “可用”是在给定磁盘或分区中备用的大小。
  • `Use` is the percentage of the used part of the given disk or partition.

    “使用”是给定磁盘或分区的已用部分的百分比。

用du命令检查 (Check with du Command)

An alternative to df command is du command. Actually, they provide different information from a different viewpoint. Du command provides information about files and directories.

df命令的替代方法是du命令。 实际上,它们从不同的角度提供不同的信息。 Du命令提供有关文件和目录的信息。

$ sudo du -sh /* 2> /dev/null
Check with du Command
Check with du Command
用du命令检查

The command may seem a bit complex. We get size summary information about directories in root path level and to clear standard error messages send them to the /dev/nul

该命令似乎有点复杂。 我们在根路径级别获取有关目录的大小摘要信息,并清除标准错误消息,并将它们发送到/ dev / nul

根据目录大小对目录进行排序 (Sort Directories According To Their Size)

We can list root-level directories according to their size in KB. Listing them according to their size is not so complex.

我们可以根据根目录的大小(KB)列出它们。 根据它们的大小列出它们并不那么复杂。

$ sudo du -s /* 2> /dev/null | sort -n -r
Sort Directories According To Their Size
Sort Directories According To Their Size
根据目录大小对目录进行排序

远程检查磁盘空间(Check Disk Space Remotely)

Checking disk space usage one by one connecting to the servers is a tedious task. It can be done remotely with ssh connection. By using ssh remote command execution feature disk command can be run without connecting to server.

逐一检查连接到服务器的磁盘空间使用情况是一项繁琐的任务。 可以通过ssh连接远程完成。 通过使用ssh远程命令执行功能,可以在不连接服务器的情况下运行disk命令。

$ ssh ubu1 "du -s /* 2> /dev/null | sort -n -r"
Check Disk Space Remotely
Check Disk Space Remotely
远程检查磁盘空间

As a standard command, we issue ssh ubu1 and then put our command to run remotely.

作为标准命令,我们发布ssh ubu1 ,然后将我们的命令远程运行。

LEARN MORE  How Raid Disk Configuration Works and Information About Raid 0, Raid 1, Raid 5, Raid 10?
了解更多Raid磁盘配置如何工作以及有关Raid 0,Raid 1,Raid 5,Raid 10的信息?

翻译自: https://www.poftut.com/linux-check-disk-space/

linux磁盘空间

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值