率Linux查看磁盘使用率:一步到位(linux查询磁盘占用)

Modern linux systems have a wealth of tools available to help users understand their disk usage and query the status of their filesystems. One of the simplest and most commonly used commands is the `df` command, which displays the total size, used and available space and the usage percentage of all mounted filesystems.

成都创新互联公司坚持“要么做到,要么别承诺”的工作理念,服务领域包括:网站建设、做网站、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的西乡塘网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!

In its simplest form the `df` command can be run without any arguments and it will display the disk usage information for all filesystems currently mounted. An example is shown below which is run on a standard Ubuntu Linux distribution.

“`console

$ df

Filesystem 1K-blocks Used Available Use% Mounted on

udev 4915212 0 4915212 0% /dev

tmpfs 1007664 90508 917156 9% /run

/dev/sda1 70372788 37401620 27054108 54% /


On the output, the `Filesystem` field shows the name of the mounted filesystem, e.g. `/dev/sda1`, the `1K-blocks` field shows the total size of the filesystem, `Used` field shows the used space, `Available` field shows the available space and the `Use%` field shows the used percentage. It's worth pointing out that the `Use%` is calculated differently than `Used` divided by `Size` in that it is based on the amount of data that can be stored in the available space.

Using the `-h` option with the `df` command makes the output more human readable by displaying values in a more standard byte size format. This can be very handy when dealing with large filesystems.

```console
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 5G 0 5G 0% /dev
tmpfs 1.0G 90M 917M 9% /run
/dev/sda1 68G 37G 27G 54% /

Finally the `-a` argument will display all mounted filesystems, including pseudo filesystems such as `/dev`, `/sys`, `/proc` and `/run`.

“`console

$ df -ah

Filesystem Size Used Avail Use% Mounted on

/dev/sda1 68G 37G 27G 54% /

udev 5G 0 5G 0% /dev

tmpfs 1.0G 90M 917M 9% /run

/dev/shm 902M 76K 902M 1% /dev/shm

/run/lock 902M 0 902M 0% /run/lock

/sys/fs/cgroup 902M 12K 902M 1% /sys/fs/cgroup

/run/user/1000 902M 48K 902M 1% /run/user/1000


The `df` command is just one of the many useful tools available to query the state and usage of filesystems on a modern Linux system. As always, it's good practice to periodically review your disk usage to keep it within acceptable limits and to identify any potential problems before they become serious.

香港服务器选创新互联,2H2G首月10元开通。
创新互联(www.cdcxhl.com)互联网服务提供商,拥有超过10年的服务器租用、服务器托管、云服务器、虚拟主机、网站系统开发经验。专业提供云主机、虚拟主机、域名注册、VPS主机、云服务器、香港云服务器、免备案服务器等。

分享文章:率Linux查看磁盘使用率:一步到位(linux查询磁盘占用)
标题路径:http://www.shufengxianlan.com/qtweb/news29/55929.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联