5 simple ways to free up space on Ubuntu

Foreword

Most people may perform the operation of freeing space when the system disk storage is insufficient, or perform this operation when the Linux system disk storage is full.

It should be executed frequently to make up for disk storage space for installing a new application and processing other files. Keeping free space is a daily task for Linux administrators to allow disk utilization to remain below the threshold.

Here are some ways we can clean up our system space.

When you have TB-level storage capacity, you may not need to clean up your system. However, if you have limited space, freeing up disk space becomes inevitable.

In this article, I will show you some of the easiest or simple ways to clean up your Ubuntu system and get more space.

**How to check the available space on Ubuntu system? **

Use the df command on your system to check the current disk utilization.

$ df -h
Filesystem  Size Used Avail Use% Mounted on
udev   975M  0 975M 0%/dev
tmpfs   200M 1.7M 198M 1%/run
/dev/sda1  30G 16G 13G 55% /
tmpfs   997M  0 997M 0%/dev/shm
tmpfs   5.0M 4.0K 5.0M 1%/run/lock
tmpfs   997M  0 997M 0%/sys/fs/cgroup

Graphical interface users can use the "Disk Utilization Analyzer Tool" to view the current utilization.

1) Remove packages that are no longer needed

The following command removes dependent libraries and packages that are no longer needed by the system. These packages are installed automatically so that an installed package satisfies the dependencies. Similarly, it will also remove the old Linux kernel installed in the system. It will remove orphaned packages that are no longer needed by the system, but it will not clear them.

$ sudo apt-get autoremove
[ sudo] password for daygeek:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
 apache2-bin apache2-data apache2-utils galera-3 libaio1 libapr1 libaprutil1
 libaprutil1-dbd-sqlite3 libaprutil1-ldap libconfig-inifiles-perl libdbd-mysql-perl
 libdbi-perl libjemalloc1 liblua5.2-0 libmysqlclient20 libopts25
 libterm-readkey-perl mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common
 mariadb-server-10.1 mariadb-server-core-10.1 mysql-common sntp socat
0 upgraded,0 newly installed,25 to remove and 23 not upgraded.
After this operation,189 MB disk space will be freed.
Do you want to continue?[Y/n]

To purge them, you can use the –purge option with the command.

$ sudo apt-get autoremove --purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
 apache2-bin* apache2-data* apache2-utils* galera-3* libaio1* libapr1* libaprutil1*
 libaprutil1-dbd-sqlite3* libaprutil1-ldap* libconfig-inifiles-perl*
 libdbd-mysql-perl* libdbi-perl* libjemalloc1* liblua5.2-0* libmysqlclient20*
 libopts25* libterm-readkey-perl* mariadb-client-10.1* mariadb-client-core-10.1*
 mariadb-common* mariadb-server-10.1* mariadb-server-core-10.1* mysql-common* sntp*
 socat*0 upgraded,0 newly installed,25 to remove and 23 not upgraded.
After this operation,189 MB disk space will be freed.
Do you want to continue?[Y/n]

2) Empty the recycle bin

There may be a lot of useless data in your recycle bin. It will take up your system space. One of the best solutions is to clean up the useless data on your system to get some free space.

To clean up these, simply use the file manager to empty your recycle bin.

3) Clean up APT cache files

Ubuntu uses APT commands (advanced package tools) for package management, such as: installation, removal, search, etc.

Generally, the Linux operating system will keep the cache files of the downloaded and installed software packages in their respective directories.

Ubuntu is the same, it keeps every update it downloads and installs in a buffer on your disk. Ubuntu keeps the DEB package buffer files in the /var/cache/apt/archives directory. Over time, these caches may grow rapidly and occupy a lot of space on your system.

Run the following command to check the current usage of APT cache files.

$ sudo du -sh /var/cache/apt
147 M /var/cache/apt

The following command will clean up obsolete deb packages. I want to say that it is not clean at all.

$ sudo apt-get autoclean

The following command will remove all packages in the apt cache.

$ sudo apt-get clean

4) Uninstall unused applications

This requires you to check the packages and games installed on your system and delete them if you rarely use them.

This can be done simply through the "Ubuntu Software Center".

5) Clear thumbnail cache

The cache folder is where the programs store data they may need again. It is reserved for speed, not necessarily reserved. It can be regenerated or downloaded again. If it really fills up your hard drive, then you can delete something without worry.

Run the following command to check the current utilization of the APT cache.

$ du -sh ~/.cache/thumbnails/
412 K /home/daygeek/.cache/thumbnails/

Run the following command to permanently delete them from your system.

$ rm -rf ~/.cache/thumbnails/*

via: https://www.2daygeek.com/linux-remove-delete-unwanted-junk-files-free-up-space-ubuntu-mint-debian/

Author: Magesh Maruthamuthu topics: lujun9972 Translator: robsean proofread: wxy

This article was originally compiled by LCTT, and honored by Linux China

to sum up

The above is the entire content of this article. I hope that the content of this article has a certain reference value for your study or work. Thank you for your support to ZaLou.Cn.

Recommended Posts

5 simple ways to free up space on Ubuntu
How to set up Gogs on Ubuntu 14.04
How to set up R on Ubuntu 14.04
How to set up Shiny Server on Ubuntu 14.04
Ways to clear disk space on CentOS 6 or CentOS 7
How to set up time synchronization on Ubuntu 18.04
How to set up a DNS server on Ubuntu 18.04
Upgrade Ubuntu 18.04 on Azure to 18.10
How to Run Tmux Service Scripts on Ubuntu Start Up
How to set up Java Home on Ubuntu and Raspbian
How to set up a Masterless Puppet environment on Ubuntu 14.04
How to set up a firewall with UFW on Ubuntu 14.04
How to set up a production Elasticsearch cluster on Ubuntu 14.04
How to set up an Apache virtual host on Ubuntu 16.04
How to set up an Apache virtual host on Ubuntu 20.04
How to set up password authentication with Nginx on Ubuntu 14.04
How to set up vsftpd for user directories on Ubuntu 16.04
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to install Vagrant on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
How to install Anaconda3 on Ubuntu 18.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install PrestaShop on Ubuntu 16.04
How to upgrade to PHP 7 on Ubuntu 14.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 18.04
How to install KVM on Ubuntu 20.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to install Jenkins on Ubuntu 18.04
How to deploy Django on Ubuntu 14.04
How to install Apache on Ubuntu 20.04
How to install R on Ubuntu 20.04
How to install Moodle on Ubuntu 16.04
How to install Solr 5.2.1 on Ubuntu 14.04
How to install Teamviewer on Ubuntu 16.04
How to secure Nginx on Ubuntu 14.04
How to install MariaDB on Ubuntu 20.04
How to install Mono on Ubuntu 20.04
How to install Go on Ubuntu 20.04
How to install Zoom on Ubuntu 20.04
How to uninstall software on Ubuntu
How to install Nginx on Ubuntu 16.04