Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Five simple ways to free space on Ubuntu

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Preface

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

It should be performed frequently to make up for 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 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 your system. However, if you have limited space, it is inevitable to free up disk space.

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

How do I check the available space on a Ubuntu system?

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

$df-hFilesystem Size Used Avail Use% Mounted onudev 975M 0975M 0% / devtmpfs 200M 1.7M 198M 1% / run/dev/sda1 30G 16G 13G 55% / tmpfs 997M 0997M 0% / dev/shmtmpfs 5.0M 4.0K 5.0M 1% / run/locktmpfs 997M 0997M 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 meets the dependency. Similarly, it removes the old Linux kernel installed on the system. It removes orphan packages that are no longer needed by the system, but does not clear them.

$sudo apt-get autoremove [sudo] password for daygeek:Reading package lists... DoneBuilding dependency treeReading state information... DoneThe 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 socat0 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 clear them, you can use the-- purge option with the command.

$sudo apt-get autoremove-purgeReading package lists... DoneBuilding dependency treeReading state information... DoneThe 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

It is possible that there is 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 space available.

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, and so on.

In general, Linux operating systems keep buffer files for downloaded and installed software packages in their respective directories.

The same goes for Ubuntu, which buffers every update it downloads and installs on your disk. Ubuntu keeps the buffer file for the DEB package in the / var/cache/apt/archives directory. Over time, these caches may grow rapidly and take up a lot of space on your system.

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

$sudo du-sh / var/cache/apt147M / var/cache/apt

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

$sudo apt-get autoclean

The following command removes 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) Clean the thumbnail cache

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

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

$du-sh ~ / .cache/thumbnails/412K / 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 topic: lujun9972 translator: robsean proofread: wxy

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

Summary

The above is the whole content of this article. I hope the content of this article has a certain reference and learning value for everyone's study or work. Thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report