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

How to remove the blue box that appears when the image is used as a hyperlink

I recently used Dreamweaver to make a product pres...

Best Practices for Developing Amap Applications with Vue

Table of contents Preface Asynchronous loading Pa...

Linux uses lsof command to check file opening status

Preface We all know that in Linux, "everythi...

Basic usage details of Vue componentization

Table of contents 1. What is componentization? 2....

Detailed explanation of Apache SkyWalking alarm configuration guide

Apache SkyWalking Apache SkyWalking is an applica...

Detailed explanation of Vue's hash jump principle

Table of contents The difference between hash and...

Why MySQL does not recommend using null columns with default values

The answer you often hear is that using a NULL va...

Solve the MySQL login 1045 problem under centos

Since the entire application needs to be deployed...

How to fix abnormal startup of mysql5.7.21

A colleague reported that a MySQL instance could ...

Detailed explanation of server-id example in MySQL master-slave synchronization

Preface When we build a MySQL cluster, we natural...

CSS3 realizes various graphic effects of small arrows

It’s great to use CSS to realize various graphics...

JavaScript flow control (branching)

Table of contents 1. Process Control 2. Sequentia...

How to configure MySQL master-slave synchronization in Ubuntu 16.04

Preparation 1. The master and slave database vers...

Detailed explanation of upgrading Python and installing pip under Linux

Linux version upgrade: 1. First, confirm that the...