trams;atomg

This commit is contained in:
geekpi 2021-03-22 08:50:02 +08:00
parent 633eee81e6
commit 17496de14e
2 changed files with 107 additions and 107 deletions

View File

@ -1,107 +0,0 @@
[#]: subject: (Use gdu for a Faster Disk Usage Checking in Linux Terminal)
[#]: via: (https://itsfoss.com/gdu/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Use gdu for a Faster Disk Usage Checking in Linux Terminal
======
There are two popular [ways to check disk usage in Linux terminal][1]: du command and df command. The [du command is more for checking the space used by a directory][2] and the df command gives you the disk utilization on filesystem level.
There are more friendly [ways to see the disk usage in Linux with graphical tools like GNOME Disks][3]. If you are confined to the terminal, you can use a [TUI][4] tool like [ncdu][5] to get the disk usage information with a sort of graphical touch.
### Gdu: Disk usage checking in Linux terminal
[Gdu][6] is such a tool written in Go (hence the g in gdu). Gdu developer has [benchmark tests][7] to show that it is quite fast for disk usage checking, specifically on SSDs. In fact, gdu is intended primarily for SSDs though it can work for HDD as well.
If you use the gdu command without any options, it shows the disk usage for the current directory you are in.
![][8]
Since it has terminal user interface (TUI), you can navigate through directories and disk using arrows. You can also sort the result by file names or size.
Heres how to do that:
* Up arrow or k to move cursor up
* Down arrow or j to move cursor down
* Enter to select directory / device
* Left arrow or h to go to parent directory
* Use d to delete the selected file or directory
* Use n to sort by name
* Use s to sort by size
* Use c to sort by items
Youll notice some symbols before some file entries. Those have specific meaning.
![][9]
* `!` means an error occurred while reading the directory.
* `.` means an error occurred while reading a subdirectory, size may not be correct.
* `@` means file is a symlink or socket.
* `H` means the file was already counted (hard link).
* `e` means directory is empty.
To see the disk utilization and free space for all mounted disks, use the option `d`:
```
gdu -d
```
It shows all the details in one screen:
![][10]
Sounds like a handy tool, right? Lets see how to get it on your Linux system.
### Installing gdu on Linux
Gdu is available for Arch and Manjaro users through the [AUR][11]. I presume that as an Arch user, you know how to use AUR.
It is included in the universe repository of the upcoming Ubuntu 21.04 but chances are that you are not using it at present. In that case, you may install it using Snap through it may seem like a lot of snap commands:
```
snap install gdu-disk-usage-analyzer
snap connect gdu-disk-usage-analyzer:mount-observe :mount-observe
snap connect gdu-disk-usage-analyzer:system-backup :system-backup
snap alias gdu-disk-usage-analyzer.gdu gdu
```
You may also find the source code on its release page:
[Source code download for gdu][12]
I am more used to of using du and df commands but I can see some Linux users might like gdu. Are you one of them?
--------------------------------------------------------------------------------
via: https://itsfoss.com/gdu/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://linuxhandbook.com/df-command/
[2]: https://linuxhandbook.com/find-directory-size-du-command/
[3]: https://itsfoss.com/check-free-disk-space-linux/
[4]: https://itsfoss.com/gui-cli-tui/
[5]: https://dev.yorhel.nl/ncdu
[6]: https://github.com/dundee/gdu
[7]: https://github.com/dundee/gdu#benchmarks
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/gdu-disk-utilization.png?resize=800%2C471&ssl=1
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/03/gdu-entry-symbols.png?resize=800%2C302&ssl=1
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/03/gdu-disk-utilization-for-all-drives.png?resize=800%2C471&ssl=1
[11]: https://itsfoss.com/aur-arch-linux/
[12]: https://github.com/dundee/gdu/releases

View File

@ -0,0 +1,107 @@
[#]: subject: (Use gdu for a Faster Disk Usage Checking in Linux Terminal)
[#]: via: (https://itsfoss.com/gdu/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
在 Linux 终端中使用 gdu 进行更快的磁盘使用情况检查
======
在 Linux 终端中有两种常用的[检查磁盘使用情况的方法][1]du 命令和 df 命令。[du 命令更多的是用来检查目录的使用空间][2]df 命令则是提供文件系统级别的磁盘使用情况。
还有更友好的[用 GNOME Disks 等图形工具在 Linux 中查看磁盘使用情况的方法][3]。如果局限于终端,你可以使用像 [ncdu][5] 这样的[ TUI][4] 工具,以一种图形化的方式获取磁盘使用信息。
### Gdu: 在 Linux 终端中检查磁盘使用情况
[Gdu][6] 就是这样一个用 Go 编写的工具(因此是 gdu 中的 “g”。Gdu 开发者的[基准测试][7]表明,它的磁盘使用情况检查速度相当快,特别是在 SSD 上。事实上gdu 主要是针对 SSD 的,尽管它也可以在 HDD 上工作。
如果你在使用 gdu 命令时没有任何选项,它就会显示你当前所在目录的磁盘使用情况。
![][8]
由于它具有终端用户界面TUI你可以使用箭头浏览目录和磁盘。你也可以按文件名或大小对结果进行排序。
你可以用它做到:
* 向上箭头或 k 键将光标向上移动
* 向下箭头或 j 键将光标向下移动
* 回车选择目录/设备
* 左箭头或 h 键转到上级目录
* 使用 d 键删除所选文件或目录
* 使用 n 键按名称排序
* 使用 s 键按大小排序
* 使用 c 键按项目排序
你将注意到一些条目前的一些符号。这些符号有特定的意义。
![][9]
* `!` 表示读取目录时发生错误。
* `.` 表示在读取子目录时发生错误,大小可能不正确。
* `@` 表示文件是一个符号链接或套接字。
* `H` 表示文件已经被计数(硬链接)。
* `e` 表示目录为空。
要查看所有挂载磁盘的磁盘利用率和可用空间,使用选项 `d`
```
gdu -d
```
它在一屏中显示所有的细节:
![][10]
看起来是个方便的工具,对吧?让我们看看如何在你的 Linux 系统上安装它。
### 在 Linux 上安装 gdu
Gdu 是通过 [AUR][11] 为 Arch 和 Manjaro 用户提供的。我想作为一个 Arch 用户,你应该知道如何使用 AUR。
它包含在即将到来的 Ubuntu 21.04 的 universe 仓库中,但有可能你现在还没有使用它。这种情况下,你可以使用 Snap 安装它,这可能看起来有很多条 snap 命令:
```
snap install gdu-disk-usage-analyzer
snap connect gdu-disk-usage-analyzer:mount-observe :mount-observe
snap connect gdu-disk-usage-analyzer:system-backup :system-backup
snap alias gdu-disk-usage-analyzer.gdu gdu
```
你也可以在其发布页面找到源代码:
[Source code download for gdu][12]
我更习惯于使用 du 和 df 命令,但我可以看到一些 Linux 用户可能会喜欢 gdu。你是其中之一吗
--------------------------------------------------------------------------------
via: https://itsfoss.com/gdu/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://linuxhandbook.com/df-command/
[2]: https://linuxhandbook.com/find-directory-size-du-command/
[3]: https://itsfoss.com/check-free-disk-space-linux/
[4]: https://itsfoss.com/gui-cli-tui/
[5]: https://dev.yorhel.nl/ncdu
[6]: https://github.com/dundee/gdu
[7]: https://github.com/dundee/gdu#benchmarks
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/gdu-disk-utilization.png?resize=800%2C471&ssl=1
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/03/gdu-entry-symbols.png?resize=800%2C302&ssl=1
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/03/gdu-disk-utilization-for-all-drives.png?resize=800%2C471&ssl=1
[11]: https://itsfoss.com/aur-arch-linux/
[12]: https://github.com/dundee/gdu/releases