5 Easy Ways to Free Up Space on Ubuntu

5 Easy Ways to Free Up Space on Ubuntu

Preface

Most people will probably perform this operation when their system disk storage is low, or they may perform this operation when their Linux system disk storage is full.

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

Here are some ways we can clean up space on our systems.

When you have terabytes of storage capacity, you probably don't 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 gain more space.

How to check available space on Ubuntu?

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

$ 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

GUI users can use the Disk Utilization Analyzer Tool to view current utilization.


1) Remove packages that are no longer needed

The following command removes the dependencies and packages that are no longer required by the system. These packages are automatically installed in order for an installed package to satisfy the dependencies. Likewise, it will remove old Linux kernels installed on your system. It will remove orphaned packages that are no longer needed by the system, but will not purge 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 space on your system. One of the best solutions is to clean up this useless data on your system to get some free space.

To clean these up, simply use your file manager to empty your Recycle Bin.


3) Clean up APT cache files

Ubuntu uses APT command (Advanced Package Tool) for package management, such as installation, removal, search, etc.

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

Ubuntu does the same, it keeps every update it downloads and installs in a cached form on your disk. Ubuntu keeps cache files of DEB packages in the /var/cache/apt/archives directory. Over time, these caches can grow quickly and take up a lot of space on your system.

Run the following command to check the current APT cache file usage.

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

The following command will clean up outdated deb packages. I mean, it's not clean at all.

$ sudo apt-get autoclean

The following command will remove all packages from apt cache.

$ sudo apt-get clean

4) Uninstall unused apps

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

This can be easily done through the Ubuntu Software Center.


5) Clear the thumbnail cache

The cache folder is where programs store data they might need again, it is kept for speed and is not essential. It can be regenerated or downloaded again. If it does fill up your hard drive, you can delete some stuff without worrying about it.

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

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

Run the following command to remove them permanently 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 Topic: lujun9972 Translator: robsean Proofreader: wxy

This article is originally compiled by LCTT and proudly launched by Linux China

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • How to solve the problem of insufficient boot partition space in Ubuntu 16.04
  • How to expand disk space in Ubuntu under VMware
  • Solution to mysql failure to start due to insufficient disk space in ubuntu

<<:  JavaScript's unreliable undefined

>>:  How to open external network access rights for mysql

Recommend

Detailed explanation of monitoring NVIDIA GPU usage under Linux

When using TensorFlow for deep learning, insuffic...

How to install iso file in Linux system

How to install iso files under Linux system? Inst...

Solution to CSS flex-basis text overflow problem

The insignificant flex-basis has caused a lot of ...

Analysis of MySQL user management operation examples

This article describes the MySQL user management ...

Django2.* + Mysql5.7 development environment integration tutorial diagram

environment: MAC_OS 10.12 Python 3.6 mysql 5.7.25...

Detailed explanation of sshd service and service management commands under Linux

sshd SSH is the abbreviation of Secure Shell, whi...

Comparative Analysis of UI Applications of Image Social Networking Sites (Figure)

In our life, work and study, social networks have ...

Summary of Linux sftp command usage

sftp is the abbreviation of Secure File Transfer ...

How to deploy HTTPS for free on Tencent Cloud

Recently, when I was writing a WeChat applet, the...

MySQL 8.0.11 installation and configuration method graphic tutorial (win10)

This article records the installation and configu...

Tutorial on upgrading from Centos7 to Centos8 (with pictures and text)

If you upgrade in a formal environment, please ba...

Analysis of the difference between emits and attrs in Vue3

Table of contents in conclusion Practice Analysis...