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

How to delete oversized files in Linux

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

Share

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

This article is about how to delete oversized files in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Typically, to delete a file on a Linux terminal, we use the rm command (delete files), the shred command (secure delete files), the wipe command (secure erase files), or the secure-deletion toolkit (a collection of secure file deletion tools).

We can use any of the above tools to deal with relatively small files. If we want to delete very large files / folders, such as about 100-200GB, it will not be as easy as you think in terms of the time it takes to delete files (IPUP O scheduling) and the RAM usage.

In this tutorial, we will explain how to delete large files / folders efficiently and reliably in Linux.

Recommended reading: 5 ways to empty or delete large files in Linux

Our main goal is to use a technique that does not slow down the system when deleting large files, using a reasonable amount of Ihand O. We can achieve this with the ionice command.

Use the ionice command to delete oversized (200GB) files in Linux

Ionice is a useful program that can set or get the scheduling level and priority of Imax O for another program. If no parameter is given or only the-p parameter is given, ionice will query the current Imax O scheduling level and priority of the process.

If we give the command name, such as the rm command, it will run the command with the given parameters. To get or set scheduling parameters, specify [PID of the process], as follows:

# ionice-p PID

To specify a name or scheduled number, use the command below (0 for none, 1 for real time, 2 for best effort, and 3 for idle).

The following command indicates that rm will belong to the idle Icano level and will only be used when other processes are not in use:

-Deleting Huge Files in Linux-# ionice-c 3 rm / var/logs/syslog # ionice-c 3 rm-rf / var/log/apache

If there is not a lot of free time in the system, then we want to use the best-effort scheduling level and use low priority:

# ionice-c 2-n 6 rm / var/logs/syslog # ionice-c 2-n 6 rm-rf / var/log/apache

Note: to delete large files using a secure method, we can use the different tools in the shred, wipe, and secure-deletion toolkits mentioned earlier, instead of the rm command.

Recommended reading: 3 ways to safely delete files / folders in Linux

For more information, check out the man page of ionice:

# man ionice Thank you for reading! This is the end of the article on "how to delete oversized files in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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