mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
Merge pull request #22744 from Piaoshi/20210729-use-df-done
提交译文[tech]:20210729 Use df to check free disk space on Linux.md
This commit is contained in:
commit
ffaf08870a
@ -7,17 +7,16 @@
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Use df to check free disk space on Linux
|
||||
使用 df 命令查看 Linux 上的可用磁盘空间。
|
||||
======
|
||||
Find out how much Linux disk space you have left with the df command.
|
||||
利用 df 命令查看 Linux 磁盘还剩多少空间。
|
||||
![Free disk space][1]
|
||||
|
||||
Drive space isn't quite as precious as it was in the early days of computing, but no matter how much space you have, there's always the potential to run out. Computers need a little space just to operate, so it's important to check occasionally to ensure you haven't inadvertently used up literally _all_ the space available on your drive. In the Linux terminal, you can do that with the `df` command.
|
||||
磁盘空间已经不像计算机早期那样珍贵,但无论你有多少磁盘空间,总有耗尽的可能。计算机需要一些磁盘空间才能启动运行,所以为了确保你没有在无意间用尽了所有的硬盘空间,偶尔检查一下是非常必要的。在 Linux 终端,你可以用 df 命令来做这件事。
|
||||
|
||||
The df command displays the amount of disk space available on the file system.
|
||||
|
||||
To make the output easy for you to read, you can use the `--human-readable` (or `-h` for short) option:
|
||||
df 命令可以显示文件系统中可用的磁盘空间。
|
||||
|
||||
要想使输出结果易于阅读,你可以加上 --human-readable(或其简写 -h)选项:
|
||||
|
||||
```
|
||||
$ df --human-readable
|
||||
@ -25,10 +24,9 @@ Filesystem Size Used Avail Use% Mounted on
|
||||
/dev/sda1 1.0T 525G 500G 52% /
|
||||
```
|
||||
|
||||
In this example, the computer's drive is 52% full, with 500 GB free for use.
|
||||
|
||||
Because Linux views its file system holistically across all mounted devices, the df command provides you details for every storage device attached to your computer. If you have lots of drives, then the output reflects that:
|
||||
在这个例子中,计算机的磁盘已经用了 52%,还有 500 GB 可用空间。
|
||||
|
||||
由于 Linux 完整地看待所有挂载设备的文件系统,df 命令会展示出连接到计算机上的每个存储设备的详细信息。如果你有很多磁盘,那么输出结果将会反映出来:
|
||||
|
||||
```
|
||||
$ df --human-readable
|
||||
@ -42,12 +40,11 @@ tmpfs 12G 848K 12G 1% /run
|
||||
/dev/sdd1 3.7T 2.4T 1.3T 65% /tux
|
||||
```
|
||||
|
||||
In this example, the `/home` directory of the computer is 87% full, with 191 GB free.
|
||||
在这个例子中,计算机的 `/home` 目录已经用了 87%,剩下 191 GB 的可用空间。
|
||||
|
||||
### See total disk space available
|
||||
|
||||
If you do have a complex file system and would like to see the total space across all drives, use the `--total` option:
|
||||
### 查看总的可用磁盘空间
|
||||
|
||||
如果你的文件系统确实很复杂,而你希望看到所有磁盘的总空间,可以使用 --total 选项:
|
||||
|
||||
```
|
||||
$ df --human-readable --total
|
||||
@ -62,11 +59,11 @@ tmpfs 12G 848K 12G 1% /run
|
||||
total 6.6T 4.0T 2.5T 62% -
|
||||
```
|
||||
|
||||
The final line of output provides the total space of the filesystem, total space used, total space available.
|
||||
输出的最后一行展示了文件系统的总空间、已用总空间、可用总空间。
|
||||
|
||||
### See disk space usage
|
||||
### 查看磁盘空间使用情况
|
||||
|
||||
To just get a summary of what's occupying the space on your drives, read our article about the [du command][2].
|
||||
如果你想大概了解哪些文件占用了磁盘空间,请阅读我们关于 [du 命令][2] 的文章。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -74,7 +71,7 @@ via: https://opensource.com/article/21/7/check-disk-space-linux-df
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[piaoshi](https://github.com/piaoshi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
Loading…
Reference in New Issue
Block a user