In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what is the batch deletion file and empty file deletion command in linux system", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "what is the batch deletion file and empty file deletion command in linux system"!
Linux: Delete a file or directory with rm(remove)
Function Description: Delete files or directories.
phrasing: rm [-dfirv][--help][--version][file or directory...]
Supplementary note: execute rm command to delete files or directories. If you want to delete directories, you must add parameter "-r", otherwise only files will be deleted by default.
Parameters:
-d or--directory directly delete the hard connection data of the directory to be deleted to 0, delete the directory.
-f or--force Forces deletion of files or directories.
-i or--interactive Ask users before deleting existing files or directories.
-r or-R or--recursive Recursive processing, all files and subdirectories under the specified directory are processed together.
-v or--verbose shows instruction execution.
--help Online help.
Linux under the batch deletion of empty files (size is equal to 0 files) method
code is as follows
find . -name "*" -type f -size 0c | xargs -n 1 rm -f
You can also delete files of a specified size by modifying the corresponding-size parameter, for example:
code is as follows
find . -name "*" -type f -size 1024c | xargs -n 1 rm -f
Delete a 1k file. (Note, however, that you do not use-size 1k, which results in a footprint of 1k, not a file size of 1k).
If you delete a folder or name link, you can change the-type parameter accordingly. For details, see man find.
Delete files N days ago
LINUX deletes files in batches by time (deletes files N days ago)
code is as follows
find /opt/Oracle/admin/CCXE/bdump/ -mtime +10 -name "*.* " -exec rm -Rf {} ;
/opt/Oracle/admin/CCXE/bdump/: Any directory you want to clean
-mtime: standard sentence writing
+10: Find files 10 days old, where numbers represent days,+30 means find files 30 days old
"*.* ": type of data you want to find,"*.jpg"means find all files with the extension jpg,"*"means find all files
-exec: fixed script
rm -rf: Forcefully delete files, including directories
{} ;: Fixed writing, a pair of braces + spaces +/+;
Delete files completely
Sometimes we want to delete some files completely, we can use shred command to achieve this, shred is part of coreutils, so this command is basically available in Linux.
Shred How to delete files completely:
code is as follows
$ shred -u file
Shred overwrites the nodes and data blocks where the file is located with random content and deletes the file (-u argument).
If you want to clean up a bit more thoroughly, you can add the-z parameter, which means filling with random data first and then filling with zeros at the end.
code is as follows
$ shred -u -z file
Shred can also erase entire partitions or disks. For example, if you want to completely erase the contents of the/dev/sdb1 partition, you can do this:
$ shred /dev/sdb1 (note not to add the-u argument)
Detailed parameters of shred:
-f, --force Change permissions Allow writes (if necessary)
-n, --iterations=N rewrite N times, default is 3 times
--random-source=FILE Read data from specified file
-s, --size=N Smashes files to a fixed size (suffixes such as K, M, C, etc. can be used)
-u, --remove Truncate and remove files after rewriting
-v, --verbose show progress
-z, --zero - add Overwrites data with zeros
- help Show help
- version Displays version information
At this point, I believe that we have a deeper understanding of "linux system in the bulk deletion of files and empty file deletion command is what", may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.