Merge pull request #14303 from robsean/patch-4

Transalted
This commit is contained in:
Xingyu.Wang 2019-06-24 22:36:51 +08:00 committed by GitHub
commit ac7ddaa212
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,28 +7,28 @@
[#]: via: (https://www.2daygeek.com/linux-remove-delete-unwanted-junk-files-free-up-space-ubuntu-mint-debian/)
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
5 Easy Ways To Free Up Space (Remove Unwanted or Junk Files) on Ubuntu
5种简单的方法来在 Ubuntu 上释放空间(移除不想要的或没有用的文件)
======
Most of us may perform this action whenever we fall into out of disk space on system.
我们中的大多数人可能在系统磁盘存储不足的情况下执行这个操作。
Most of us may perform this action whenever we are running out of space on Linux system
我们中的大多数人可能在 Linux 系统磁盘存储不足的情况下执行这个操作。
It should be performed frequently, to make space for installing a new application and dealing with other files.
它应该被经常执行,来为安装一个新的应用程序和处理其它文件弥补磁盘存储空间。
Housekeeping is one of the routine task of Linux administrator, which allow them to maintain the disk utilization is in under threshold.
内务处理是 Linux 管理员的一个日常任务,管理员允许内务处理在阈值下维持磁盘利用率。
There are several ways we can clean up our system space.
这里有一些我们可以清理我们系统空间的方法。
There is no need to clean up your system when you have TB of storage capacity.
当你有 TB 级存储容量时,不需要清理你的系统。
But if your have limited space then freeing up disk space becomes a necessity.
但是,如果你空间有限,那么释放磁盘空间,变的不可避免。
In this article, Ill show you some of the easiest or simple ways to clean up your Ubuntu system and get more space.
在这篇文章中,我将向你展示一些最容易的或简单的方法来清理你的 Ubuntu 系统,获得更多空间。
### How To Check Free Space On Ubuntu Systems?
### 在 Ubuntu 系统上如何检查可用的空间?
Use **[df Command][1]** to check current disk utilization on your system.
在你的系统上使用 **[df 命令][1]** 来检查当前磁盘利用率。
```
$ df -h
@ -41,18 +41,18 @@ tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 997M 0 997M 0% /sys/fs/cgroup
```
GUI users can use “Disk Usage Analyzer tool” to view current usage.
图形界面用户可以使用“磁盘利用率分析器工具”来查看当前利用率。
[![][2]![][2]][3]
### 1) Remove The Packages That Are No Longer Required
### 1) 移除不再需要的软件包
The following command removes the dependency libs and packages that are no longer required by the system.
下面的命令移除系统不再需要依赖的库和软件包。
These packages were installed automatically to satisfy the dependencies of an installed package.
这些软件包自动地安装来使一个被安装软件包满足的依赖关系。
Also, it removes old Linux kernels that were installed in the system.
同样,它移除安装在系统中的旧的 Linux 内核。
It removes orphaned packages which are not longer needed from the system, but not purges them.
它移除不再被系统需要的孤立的软件包,但是不清除它们。
```
$ sudo apt-get autoremove
@ -71,7 +71,7 @@ After this operation, 189 MB disk space will be freed.
Do you want to continue? [Y/n]
```
To purge them, use the `--purge` option together with the command for that.
为清除它们,与命令一起使用 `--purge` 选项。
```
$ sudo apt-get autoremove --purge
@ -90,67 +90,67 @@ After this operation, 189 MB disk space will be freed.
Do you want to continue? [Y/n]
```
### 2) Empty The Trash Can
### 2) 清空回收站
There might a be chance, that you may have a large amount of useless data residing in your trash can.
这可能有风险,你可能有大量的无用数据存在于你的回收站中。
It takes up your system space. This is one of the best way to clear up those and get some free space on your system.
它占用你的系统空间。这是最好的一个方法来在你的系统上清理这些无用的数据,并获取一些可用的空间。
To clean up this, simple use the file manager to empty your trash can.
为清理这些,简单地使用文件管理器来清空你的回收站。
[![][2]![][2]][4]
### 3) Clean up the APT cache
### 3) 清理 APT 缓存文件
Ubuntu uses **[APT Command][5]** (Advanced Package Tool) for package management like installing, removing, searching, etc,.
Ubuntu 使用 **[APT 命令][5]** (高级软件包工具)用于软件包管理,像:安装,移除,搜索等等。
By default every Linux operating system keeps a cache of downloaded and installed packages on their respective directory.
默认情况下,每个 Linux 操作系统在它们各自的命令保留下载和安装的软件包的缓冲。
Ubuntu also does the same, it keeps every updates it downloads and installs in a cache on your disk.
Ubuntu 也做相同的事,它以缓冲的形式在你的磁盘上保留它下载和安装的每次更新。
Ubuntu system keeps a cache of DEB packages in /var/cache/apt/archives directory.
Ubuntu 在 /var/cache/apt/archives 目录中保留 DEB 软件包的缓冲文件。
Over time, this cache can quickly grow and hold a lot of space on your system.
随着时间推移,这些缓存可能快速增长,并在你的系统上占有很多空间。
Run the following command to check the current utilization of APT cache.
运行下面的命令来检查当前 APT 缓存文件的使用率。
```
$ sudo du -sh /var/cache/apt
147M /var/cache/apt
```
It cleans obsolete deb-packages. I mean to say, less than clean.
它清理过时的 deb 软件包。我想说,一点都清理不干净。
```
$ sudo apt-get autoclean
```
It removes all packages kept in the apt cache.
它移除所有在 apt 缓存中的软件包。
```
$ sudo apt-get clean
```
### 4) Uninstall the unused applications
### 4) 卸载不使用的应用程序
I would request you to check the installed packages and games on your system and delete them if you are using rarely.
我可能要求你来检查在你的系统上安装的软件包和游戏,,删除它们,如果你很少使用。
This can be easily done via “Ubuntu Software Center”.
这可以简单地完成,通过 “Ubuntu 软件中心”。
[![][2]![][2]][6]
### 5) Clean up the thumbnail cache
### 5) 清理缩略图缓存
The cache folder is a place where programs stored data they may need again, it is kept for speed but is not essential to keep. It can be generated again or downloaded again.
缓存文件夹是程序存储它们可能再次需要的数据的地方,它是为速度保留的,而不是必需保留的。它可以被再次生成或再次下载。
If its really filling up your hard drive then you can delete things without worrying.
假如它真的填满你的硬盘,那么你可以删除一些东西而不用担心。
Run the following command to check the current utilization of APT cache.
运行下面的命令来检查当前 APT 缓存的利用率。
```
$ du -sh ~/.cache/thumbnails/
412K /home/daygeek/.cache/thumbnails/
```
Run the following command to delete them permanently from your system.
运行下面的命令来从你的系统中永久地删除它们。
```
$ rm -rf ~/.cache/thumbnails/*
@ -162,7 +162,7 @@ via: https://www.2daygeek.com/linux-remove-delete-unwanted-junk-files-free-up-sp
作者:[Magesh Maruthamuthu][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
译者:[robsean](https://github.com/robsean)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出