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 the use of grid properties in CSS

Grid layout Attributes added to the parent elemen...

jQuery implements accordion effects

This article shares the specific code of jQuery t...

Graphical tutorial on installing JDK1.8 under CentOS7.4

Linux installation JDK1.8 steps 1. Check whether ...

10 content-related principles to improve website performance

<br />English address: http://developer.yaho...

How to set focus on HTML elements

Copy code The code is as follows: <body <fo...

Solve the matching problem in CSS

Problem Description As we all know, when writing ...

Records of using ssh commands on Windows 8

1. Open the virtual machine and git bash window a...

Usage and scenario analysis of npx command in Node.js

npx usage tutorial Tonight, when I was learning V...

Example of adding multi-language function to Vue background management

Table of contents 1. First, configure the main.js...

MySQL cross-table query and cross-table update

Friends who have some basic knowledge of SQL must...

Two ways to configure Vue global methods

Table of contents 1. Introduction 2. The first me...

Html page supports dark mode implementation

Since 2019, both Android and IOS platforms have s...

Tomcat source code analysis of Web requests and processing

Table of contents Preface 1. EndPoint 2. Connecti...

SSM implements the mysql database account password ciphertext login function

introduction Our company is engaged in the resear...