Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang
2020-11-12 22:33:24 +08:00
8 changed files with 384 additions and 238 deletions

View File

@@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: ( )
[#]: url: ( )
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12813-1.html)
[#]: subject: (How JavaScript became a serious programming language)
[#]: via: (https://opensource.com/article/20/10/history-javascript)
[#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha)
@@ -12,7 +12,7 @@ JavaScript 是如何成为一门严肃的编程语言的
> 从最开始作为一种使网站变得漂亮的方式JavaScript 已转变为一种严肃的编程语言。
![Javascript 代码特写与霓虹灯图形叠加][1]
![](https://img.linux.net.cn/data/attachment/album/202011/12/010945vezib4p1b1ti6pjt.jpg)
JavaScript 的卑微起步始于 1995 年,是由当时在 Netscape 通信公司工作的 Brendan Eich [在短短 10 天内创建的][2]。从那时起JavaScript 已经走过了漫长的道路,从一个让网站变得漂亮的工具变成了一种严肃的编程语言。

View File

@@ -1,24 +1,25 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12814-1.html)
[#]: subject: (Tweak your Git config for multiple user IDs)
[#]: via: (https://opensource.com/article/20/10/git-config)
[#]: author: (Ramanathan M https://opensource.com/users/muthiahramanathan)
调整你的 Git 配置以适应多个用户 ID 的需要
======
使用相同的机器用于工作和个人的 Git 提交,而无需手动重置你的配置。
![Chat via email][1]
Git 的 [git config][2] 命令可以让你为 Git 设置仓库或全局选项。它有很多选项,其中的一个选项 `includeIf` 在你使用在 Git 时有双重角色时非常方便,比如说,你既是全职的开发者,又在业余时间为开源项目做贡献。在这种情况下,大多数人都不想为两个角色使用一个共同的配置,或者,至少,他们宁愿保持配置的某些部分是不同的,尤其是当他们在两个角色中使用同一台计算机时
> 可以使用相同的机器用于工作和个人的 Git 提交,而无需手动重置你的配置
![](https://img.linux.net.cn/data/attachment/album/202011/12/013805t4u4nu57rc6ur7nt.jpg)
Git 的 [git config][2] 命令可以让你为 Git 设置仓库或全局选项。它有很多选项,其中的一个选项 `includeIf` 在你使用在 Git 时有双重角色时非常方便,比如说,你既是全职的开发者,又在业余时间为开源项目做贡献。在这种情况下,大多数人都不想为两个角色使用一个共同的配置,或者,至少,他们肯定希望保持配置的某些部分是不同的,尤其是当他们在两个角色中使用同一台计算机时。
我的情况就是这样,所以我在 Git 配置中保留了两组不同的邮件 ID。这样一来在我工作场所的项目仓库中提交的内容就会使用我办公室的邮件 ID而在我个人 GitHub 帐户中提交的内容则使用我个人的邮件 ID。
以下是我的全局配置(维护在 `$HOME/.gitconfig`)中的一个片段,我将在下文中介绍。
```
[includeIf "gitdir:~/priv_scm/"]
        path = ~/priv_scm/.gitconfig
@@ -28,7 +29,7 @@ Git 的 [git config][2] 命令可以让你为 Git 设置仓库或全局选项。
### 什么是 includeIf
`includeIf.condition.path` 变量,是 `include` 配置指令的一部分,允许你有条件地设置自定义 config。同时,自定义配置的路径也可以作为指令的一部分来设置。
`includeIf.condition.path` 变量,是 `include` 配置指令的一部分,允许你有条件地设置自定义配置。同时,自定义配置的路径也可以作为指令的一部分来设置。
这个指令支持三个关键字:`gitdir``gitdir/I``onbranch`。我将简单解释一下 `gitdir`,我在上面的代码片段中使用了它。你可以在[文档][3]中了解其他两个关键词。
@@ -42,7 +43,6 @@ Git 的 [git config][2] 命令可以让你为 Git 设置仓库或全局选项。
这里是一个例子 `$HOME/priv_scm/.gitconfig` 的片段:
```
$ cat $HOME/priv_scm/.gitconfig
[user]
@@ -63,7 +63,7 @@ via: https://opensource.com/article/20/10/git-config
作者:[Ramanathan M][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@@ -1,95 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (GnuCash: A Powerful Open Source Accounting Software)
[#]: via: (https://itsfoss.com/gnucash/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
GnuCash: A Powerful Open Source Accounting Software
======
_**Brief: GnuCash is a popular free and open-source accounting software that can be used to manage personal finance as well as business transactions.**_
Considering the complexities of managing personal finances and business transactions, you will find a lot of online services or software tools that aim to simplify things. Some tools simply let you add expenses and income to keep track of your savings while others offer different features.
I have already covered several [open source account software][1] in the past. Here, I will be focusing on one of the options — **GnuCash**, which is a popular free accounting software with plenty of features for every user.
### GnuCash: Free & Open Source Accounting Software
![][2]
GnuCash is a free accounting software tailored for professional requirements to track transactions, stocks, etc. It is available for Linux, BSD, macOS, and Windows as well.
Even though it can be overwhelming to start with, it is easy to use for managing personal transactions as well. You can get a detailed report to analyze after youve started managing an account and added transactions to it.
### Features of GnuCash
![][3]
As I mentioned earlier, GnuCash comes loaded with a bunch of features which could be overwhelming for someone new to accounting, but I think it should be worth it:
* Double-entry Accounting
* Stock/Bond/Mutual Fund accounts
* Small-business accounting with tax support (like GST in India)
* Detailed report for breakdown
* Graph for easy analysis
* Financial calculations support
* Auto-saving feature
* Color coding
* Online Banking Wizard
* Journal
* Loan repayment calculator
* Price database for quick calculation
* Budget balance sheet, flow, graph for each category
* Ability to export as CSV
* Add Customer, Vendor, and Employee records separately
* Scheduled transactions
* Ability to set a Budget
* Configuring bill generator to ease up the accounting process
Im no expert but this is just the tip of the iceberg. You will find a host of options to customize and set for your accounting needs.
![Gnucash Report][4]
### Installing GnuCash on Linux
You can find GnuCash in the software center of your Linux distribution. Install it from there or use the [package manager of your distribution][5].
A [Flatpak package][6] is also available for those who want the latest version. In case you didnt know, Id suggest you to go through our [Flatpak guide][7].
Alternatively, you can build it from source or you can head to their [official download page][8] to explore options for your Linux distribution.
[GnuCash][9]
### Wrapping Up
For basic personal finance management, it was a little overwhelming for me because I prefer to use an Android app for simplicity. However, if you take a look around for a few minutes, it is easy to understand and GnuCash seems flexible for most requirements.
If you like to manage your or your businesss finances, you may give it a try. It is definitely better than keeping data in spreadsheet :)
--------------------------------------------------------------------------------
via: https://itsfoss.com/gnucash/
作者:[Ankush Das][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/ankush/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/open-source-accounting-software/
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash.jpg?resize=800%2C633&ssl=1
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-screenshot.jpg?resize=800%2C636&ssl=1
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-report.jpg?resize=800%2C638&ssl=1
[5]: https://itsfoss.com/package-manager/
[6]: https://flathub.org/apps/details/org.gnucash.GnuCash
[7]: https://itsfoss.com/flatpak-guide/
[8]: https://www.gnucash.org/download.phtml#distribution
[9]: https://www.gnucash.org

View File

@@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@@ -1,129 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Check Free Disk Space on Linux [Terminal and GUI Methods])
[#]: via: (https://itsfoss.com/check-free-disk-space-linux/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
How to Check Free Disk Space on Linux [Terminal and GUI Methods]
======
_**How much disk space I have utilized?**_
The simplest way to find the free disk space on Linux is to [use df command][1]. The df command stands for disk-free and quite obviously, it shows you the free and available disk space on Linux systems.
```
df -h
```
With `-h` option, it shows the disk space in human-readable format (MB and GB).
Heres the output of the df command for my Dell XPS system that has only Linux installed with encrypted disk:
![Checking free disk space with df command in Linux][2]
If the above output is confusing for you, dont worry. Ill explain a few things around checking available disk space in Linux. _**Ill also show the GUI method for desktop Linux users.**_
### Method 1: Checking free disk space in Linux with df command (and understanding its output)
When you use the df command to check disk space, it will show a bunch of file systems with their size, used space and free space. Your actual disks should normally be listed as one of the following:
* /dev/sda
* /dev/sdb
* /dev/nvme0n1p
This is not a hard and fast rule but it gives you an indication to easily recognize the actual disk from the crowd.
Your Linux system might have several partitions on your disk for boot, EFI, root, swap, home etc. In such cases, these partitions are reflected with a number at the end of the disk name, like /dev/sda1, /dev/nvme0n1p2 etc.
You could identify which partition is used for what purpose from its mount point. Root is mounted on /, EFI in /boot/EFI etc.
In my case, I have used 41% of the 232 GB of disk space under root. If you have 2-3 big partitions (like root, home etc), youll have to make a calculation here.
![Understanding df command output][3]
* **tmpfs**: The [tmpfs][4] (temporary filesystem) used for keeping files in virtual memory. You can ignore this virtual filesystem comfortably.
* **udev**: The [udev filesystem][5] is used for storing information related to devices (like USB, network card, CD ROM etc) plugged to your system. You may ignore it as well.
* **/dev/loop**: These are loop devices. Youll see plenty of them while checking disk space in Ubuntu because of snap applications. Loops are virtual devices that allow normal files to be accessed as block devices. With the loop devices, snap applications are sandboxed in their own virtual disk. Since they are under root, you dont need to count their used disk space separately.
#### Missing disk space? Check if you have mounted all disks and partitions
Keep in mind that the df command only shows disk space for mounted filesystems. If you are using more than one Linux distribution (or operating systems) on the same disk or you have multiple disks on your system, you need to mount them first in order to see the free space available on those partitions and disks.
For example, my [Intel NUC][6] has two SSDs and 4 or 5 Linux distributions installed on them. It shows additional disks only when I mount them explicitly.
![][7]
You can use the lsblk command to see all the disks and partitions on your system.
![][8]
Once you have the disk partition name, you can mount it in this fashion:
```
sudo mount /dev/sdb2 /mnt
```
I hope this gives you a pretty good idea about checking hard drive space on Linux. Lets see how to do it graphically.
### Method 2: Check free disk usage graphically
Checking free disk space graphically is much easier in Ubuntu with the Disk Usage Analyzer tool.
![Disk Usage Analyzer Tool][9]
Youll see all the actual disks and partitions here. You may have to mount some partitions by clicking on them. It displays the disk usage for all the mounted partitions.
![Disk usage check][10]
#### Checking free disk space with GNOME Disks utility
Otherwise, the GNOME Disks utility is also pretty handy tool.
![GNOME Disks Tool][11]
Start the tool and select the disk. Select a partition to see the free disk space. If a partition is not mounted, mount it first by clicking the play icon.
![Free Disk Space Check in Ubuntu Desktop][12]
I think all major desktop environments have some sort of graphical tool to check the disk usage on Linux. You can search for it in the menu of your desktop Linux system.
**Conclusion**
There can be more ways and tools to check the disk space of course. I showed you the most common command line and GUI methods for this purpose.
I also explained a few things that might trouble you in understanding the disk usage. Hope you like it.
If you have questions or suggestions, please let me know in the comment section.
--------------------------------------------------------------------------------
via: https://itsfoss.com/check-free-disk-space-linux/
作者:[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://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-linux-df-command-output.png?resize=786%2C475&ssl=1
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-output.png?resize=800%2C600&ssl=1
[4]: https://www.kernel.org/doc/html/latest/filesystems/tmpfs.html
[5]: https://wiki.debian.org/udev
[6]: https://itsfoss.com/install-linux-on-intel-nuc/
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-ubuntu-1.png?resize=786%2C443&ssl=1
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/lsblk-command-to-see-disks-linux.png?resize=786%2C538&ssl=1
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/disk-usage-analyzer-tool-linux.jpg?resize=800%2C250&ssl=1
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-ubuntu-desktop.png?resize=800%2C648&ssl=1
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/disks-tool-linux.jpg?resize=800%2C250&ssl=1
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-check-ubuntu-desktop.png?resize=800%2C600&ssl=1

View File

@@ -0,0 +1,146 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Using Fedora 33 with Microsofts WSL2)
[#]: via: (https://fedoramagazine.org/wsl-fedora-33/)
[#]: author: (Jim Perrin https://fedoramagazine.org/author/jperrin/)
Using Fedora 33 with Microsofts WSL2
======
![][1]
Photo by [Matthias Heil][2] on [Unsplash][3]
If youre like me, you may find yourself running Windows for a variety of reasons from work to gaming. Sure you could run Fedora in a virtual machine or as a container, but those dont blend into a common windows experience as easily as the Windows Subsystem for Linux (WSL). Using Fedora via WSL will let you blend the two environments together for a fantastic development environment.
### Prerequisites
There are a few basics youll need in order to make this all work. You should be running Windows 10, and have WSL2 installed already. If not, check out the [Microsoft documentation for instructions][4], and come back here when youre finished. Microsoft recommends setting wsl2 as the distro default for simplicity. This guide assumes youve done that.
Next, youre going to need some means of unpacking xz compressed files. You can do this with another WSL-based distribution, or use [7zip][5].
### Download a Fedora 33 rootfs
Since Fedora doesnt ship an actual rootfs archive, were going to abuse the one used to generate the container image for dockerhub. You will want to download the [tar.xz file][6] from the fedora-cloud GitHub repository. Once you have the tar.xz, uncompress it, but dont unpack it. You want to end up with something like fedora-33-_datestamp_.tar. Once you have that, youre ready to build the image.
### Composing the WSL Fedora build
I prefer to use _c:\distros_, but you can choose nearly whatever location you want. Whatever you choose, make sure the top level path exists before you import the build. Now open a cmd or powershell prompt, because its time to import:
```
```
wsl.exe --import Fedora-33 c:\distros\Fedora-33 $HOME\Downloads\fedora-33.tar
```
```
You will see Fedora-33 show up in wsls list
```
```
PS C:\Users\jperrin> wsl.exe -l -v
  NAME                   STATE           VERSION
  Fedora-33                 Stopped         2
```
```
From here, you can start to play around with Fedora in wsl, but we have a few things we need to do to make it actually _useful_ as a wsl distro.
```
```
wsl -d Fedora-33
```
```
This will launch Fedoras wsl instance as the root user. From here, youre going to install a few core packages and set a new default user. Youre also going to need to configure sudo, otherwise you wont be able to easily elevate privileges if you need to install something else later.
```
```
dnf update
dnf install wget curl sudo ncurses dnf-plugins-core dnf-utils passwd findutils
```
```
_wslutilites_ uses _curl_ and _wget_ for things like VS Code integration, so theyre useful to have around. Since you need to use a Copr repo for this, you want the added dnf functionality.
### Add your user
Now its time to add your user, and set it as the default.
```
```
useradd -G wheel yourusername
passwd yourusername
```
```
Now that youve created your username and added a password, make sure they work. Exit the wsl instance, and launch it again, this time specifying the username. Youre also going to test sudo, and check your uid.
```
```
wsl -d Fedora-33 -u yourusername
$id -u
1000
$ sudo cat /etc/shadow
```
```
Assuming everything worked fine, youre now ready to set the default user for your Fedora setup in Windows. To do this, exit the wsl instance and get back into Powershell. This Powershell one-liner configures your user properly:
```
```
Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\\*\ DistributionName | Where-Object -Property DistributionName -eq Fedora-33  | Set-ItemProperty -Name DefaultUid -Value 1000
```
```
Now you should be able to launch WSL again without specifying a user, and be yourself instead of root.
### Customize!
From here, youre done getting the basic Fedora 33 setup running in wsl, but it doesnt have the Windows integration piece yet. If this is something you want, theres a Copr repo to enable. If you choose to add this piece, youll be able to run Windows apps directly from inside your shell, as well as integrate your Linux environment easily with VS Code. Note that Copr is not officially supported by Fedora infrastructure. Use packages at your own risk
```
```
dnf copr enable trustywolf/wslu
```
```
Now you can go configure your terminal, setup a Python development environment, or however else you want to use Fedora 33. Enjoy!
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/wsl-fedora-33/
作者:[Jim Perrin][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://fedoramagazine.org/author/jperrin/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/wsl-fedora33-816x345.jpg
[2]: https://unsplash.com/@matthias_heil?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[3]: https://unsplash.com/s/photos/windows?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: https://docs.microsoft.com/en-us/windows/wsl/install-win10
[5]: https://www.7-zip.org/download.html
[6]: https://github.com/fedora-cloud/docker-brew-fedora/tree/33/x86_64

View File

@@ -0,0 +1,95 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (GnuCash: A Powerful Open Source Accounting Software)
[#]: via: (https://itsfoss.com/gnucash/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
GnuCash一个强大的开源会计软件
======
_**简介GnuCash 是一款流行的免费开源会计软件,可用于管理个人财务和商业交易。**_
考虑到管理个人财务和商业交易的复杂性,你会发现有很多旨在简化这些的在线服务或软件工具。有些工具只是让你添加支出和收入来跟踪你的储蓄,而其他一些工具则提供不同的功能。
我在过去已经介绍过几个[开源会计软件][1]。在这里,我将重点介绍其中一个 — **GnuCash**,它是一款很流行的免费会计软件,为所有用户提供了很多功能。
### GnuCash: 免费且开源的会计软件
![][2]
GnuCash 是一款为专业需求量身定做的免费会计软件,可以追踪交易、股票等。它适用于 Linux、BSD、macOS 和 Windows。
虽然刚开始使用可能会让人不知所措,但对于管理个人交易而言很容易使用。在你开始管理一个账户,并添加交易后,你可以得到一个详细的报告。
### GnuCash 的功能
![][3]
正如我前面提到的GnuCash 带来了一大堆功能,这对于一个刚接触会计的人来说可能会让人不知所措,但我认为它应该是值得的:
* 复式记账
* 股票/债券/共同基金账户
* 有税务支持的小企业会计(如印度的商品和服务税)
* 详细的分类报告
* 便于分析的图表
* 支持财务计算
* 自动保存功能
* 彩色编码
* 网上银行向导
* 日志
* 贷款还款计算器
* 用于快速计算的价格数据库
* 每个类别的预算平衡表、流程、图表
* 能够以 CSV 格式导出
* 分别添加客户、供应商和雇员记录。
* 计划交易记录
* 制定预算的能力
* 配置账单生成器,以简化会计程序。
我不是专家,但这只是冰山一角。你会发现有很多选项可以根据你的会计需求进行定制和设置。
![Gnucash Report][4]
### 在 Linux 上安装 GnuCash
你可以在你的 Linux 发行版的软件中心找到 GnuCash。从那里安装或使用[发行版的软件包管理器][5]。
对于那些想要最新版本的人来说,还可以使用 [Flatpak 包][6]。如果你不知道它,我建议你去看看我们的 [Flatpak 指南][7]。
另外,你也可以从源码构建,或者你可以前往他们的[官方下载页面][8]来探索适合你的 Linux 发行版选项。
[GnuCash][9]
### 总结
对于基本的个人理财来说这对我来说有点复杂因为我更喜欢安卓应用的简单。不过如果你试上几分钟就会发现它很容易理解GnuCash 似乎可以灵活地满足大多数要求。
如果你想管理自己或企业的财务,你可以尝试一下。它绝对比在电子表格中保存数据要好。 :)
--------------------------------------------------------------------------------
via: https://itsfoss.com/gnucash/
作者:[Ankush Das][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/ankush/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/open-source-accounting-software/
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash.jpg?resize=800%2C633&ssl=1
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-screenshot.jpg?resize=800%2C636&ssl=1
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-report.jpg?resize=800%2C638&ssl=1
[5]: https://itsfoss.com/package-manager/
[6]: https://flathub.org/apps/details/org.gnucash.GnuCash
[7]: https://itsfoss.com/flatpak-guide/
[8]: https://www.gnucash.org/download.phtml#distribution
[9]: https://www.gnucash.org

View File

@@ -0,0 +1,129 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Check Free Disk Space on Linux [Terminal and GUI Methods])
[#]: via: (https://itsfoss.com/check-free-disk-space-linux/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
如何在 Linux 上检查可用的磁盘空间 [终端和 GUI 方法]
======
_**我已经使用了多少磁盘空间?**_
在 Linux 上查找可用磁盘空间的最简单的方法是 [使用 df 命令][1] 。df 命令从字面意思上代表着可用空间,很明显,它将向你显示在 Linux 系统上的可用磁盘空间。
```
df -h
```
使用 `-h` 选项,它将以人类可读的格式 (MB 和 GB) 来显示磁盘空间。
这里是针对我 Dell XPS 系统的 df 命令的输出,它使用了加密磁盘并且只安装了 Linux :
![在 Linux 中使用 df 命令检查可用磁盘空间][2]
如果上面的输出使你感到困惑,不用担心。我将介绍一些关于在 Linux 中检查可用磁盘空间的东西。_**我也将为桌面 Linux 用户展示 GUI 方法。**_
### 方法 1: 使用 df 命令来检查在 Linux 中的可用磁盘空间(并理解它的输出)
当你使用 df 命令来检查磁盘空间时,它将显示一组 ‘文件系统’,包括它们的大小,使用的空间和可用的空间。你实际的磁盘通常应该下面列表中的一个:
* /dev/sda
* /dev/sdb
* /dev/nvme0n1p
这不是硬性的标准,但是它给予你一个标志,它可以让你能够很容易地从一堆文字中辨别出真正是磁盘。
你的 Linux 系统在你的磁盘上可能有一些用于 boot, EFI, root, swap, home 等的分区。在这种情况下,这些分区在 ‘磁盘名称’ 的结尾处使用一个数字来标示,像 /dev/sda1, /dev/nvme0n1p2 等等。
你可以从它们的挂载点来辨认出哪个分区是用于做什么的。Root 挂载在 /, EFI 在 /boot/EFI 等等。
就我的情况来说,我已经使用了 root 分区下磁盘空间 ( 232 GB ) 的 41% 。如果你有 2 到 3 个大分区(像 root, home 等等),你将不得不在这里计算一下已使用的磁盘空间。
![理解 df 命令输出][3]
* **tmpfs**: [tmpfs][4] (临时文件系统) 用于在虚拟存储器中保持文件。你可以随意地忽略这个虚拟文件系统。
* **udev**: [udev 文件系统][5] 用于存储插入到你系统的设备(像 USB网卡CD ROM 等等) 的相关信息。你也可以忽略它。
* **/dev/loop**: 它们是 loop 设备。由于 snap 应用程序,在 Ubuntu 中检查磁盘时你将看到很多的这样的设备。loop 设备是虚拟设备,它们允许普通文件作为块设备文件来访问。使用 loop 设备snap 应用程序在它们自己的虚拟磁盘中进行沙盒处理。尽管它们是在 root 下,但是你不需要单独计算它们使用的磁盘空间。
#### 丢失磁盘空间?检查你是否挂载了所有是磁盘和分区
记住df 命令仅显示已挂载文件系统的磁盘空间。如果你在同一块磁盘上使用多个 Linux 发行版 (或者多个操作系统),或者在你的系统上有多个磁盘 ,你需要先挂载它们,以便查看在这些分区和磁盘上的可用磁盘空间。
例如,我的 [Intel NUC][6] 有两个 SSD 磁盘并且在其上有4个或5个 Linux 分区。仅当我明确地挂载它们时df 命令才会显示附加的磁盘。
![][7]
你可以使用 lsblk 命令来查看在你系统上的所有磁盘和分区。
![][8]
在你有了磁盘分区名称后,你可以用这种方式来挂载它:
```
sudo mount /dev/sdb2 /mnt
```
我希望这种方法能够给你提供一个在 Linux 上检查硬盘驱动器空间的好主意。让我们看看如何在 GUI 下来完成。
### 方法 2: 在 GUI 下检查可用磁盘使用情况
在 Ubuntu 中使用 Disk Usage Analyzer 工具来在 GUI 的方式下检查可用磁盘空间是很容易的。
![Disk Usage Analyzer 工具][9]
在这里,你将看到所有实际的磁盘和分区。你可能需要单击一些分区来挂载它们。它显示所有已挂载分区的磁盘使用情况。
![磁盘使用情况检查][10]
#### 使用 GNOME 的 Disks 实用程序来检查可用磁盘空间
除此之外GNOME 的 Disks 实用程序也是非常容易使用的工具。
![GNOME 的 Disks 工具][11]
启动工具和选择磁盘。选择一个分区来查看可用磁盘空间。如果没有挂载分区,那么先通过单击 play 图标来挂载它。
![检查 Ubuntu 的桌面版本的可用磁盘空间][12]
我认为在 Linux 上的所有主要桌面环境都有某种图形工具来检查磁盘使用情况。你可以在你是桌面 Linux 系统的菜单中搜索它。
**结束语**
当然,这里可能有很多方法和工具来检查磁盘空间。为此,我向你显示了最常用的命令行方法和 GUI 方法。
我也解释一些可能会让你很难理解磁盘使用情况的东西。希望你喜欢它。
如果你有问题或建议,请在评论区告诉我。
--------------------------------------------------------------------------------
via: https://itsfoss.com/check-free-disk-space-linux/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[robsean](https://github.com/robsean)
校对:[校对者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://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-linux-df-command-output.png?resize=786%2C475&ssl=1
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-output.png?resize=800%2C600&ssl=1
[4]: https://www.kernel.org/doc/html/latest/filesystems/tmpfs.html
[5]: https://wiki.debian.org/udev
[6]: https://itsfoss.com/install-linux-on-intel-nuc/
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-ubuntu-1.png?resize=786%2C443&ssl=1
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/lsblk-command-to-see-disks-linux.png?resize=786%2C538&ssl=1
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/disk-usage-analyzer-tool-linux.jpg?resize=800%2C250&ssl=1
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-ubuntu-desktop.png?resize=800%2C648&ssl=1
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/disks-tool-linux.jpg?resize=800%2C250&ssl=1
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-check-ubuntu-desktop.png?resize=800%2C600&ssl=1