In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the deletion of Linux files with spaces (not directories), the article through the sample code introduced in great detail, for everyone's study or work has a certain reference learning value, the need for friends below along with the editor to learn it.
People usually have more contact with documents without spaces in their work. In this way, the delete operation is relatively simple. But sometimes we come into contact with files with spaces. How should we delete this kind of file?
First, let's demonstrate the find command combined with the xargs command to delete files without spaces.
[root@ELK-chaofeng test] # touch 1.txt 2.txt [root@ELK-chaofeng test] # ls1.txt 2.txt [root@ELK-chaofeng test] # find. -type f | xargs./1.txt. / 2.txt [root@ELK-chaofeng test] # find. -type f | xargs rm-rf [root@ELK-chaofeng test] # ls [root@ELK-chaofeng test] #
Next we will show you how to delete a file with spaces.
[root@ELK-chaofeng test] # touch 1.txt 2.txt' 1 2.txt' [root@ELK-chaofeng test] # ls1 2.txt 1.txt 2.txt [root@ELK-chaofeng test] # lltotal 0kuhashi rwkashi-1 root root 0 Feb 14 12:24 1 2.txtMashi RKui-1 root root 0 Feb 14 12:24 1.txtKui RWKui [1 root root 0 Feb 14 12:24 2.txt] # find. -type f-print0 | xargs-0 rm-rf [root@ELK-chaofeng test] # ls
The above parameter-print0, compared to the default-print, the output sequence is not separated by spaces, but by null characters. Xargs also has a parameter of-0, which accepts input streams separated by null instead of spaces.
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
The original text is from: https://www.linuxprobe.com/deletes-files-spaces.html
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.