网站首页 > 精选文章 正文
方法1
删除当前路径下属主为root的所有文件和文件夹
find ./* -user root -print0 | xargs -0 rm -rf
删除当前路径下属组为root的所有文件和文件夹
find ./* -group root -print0 | xargs -0 rm -rf
为了防止删错,开始时最好分步执行命令,当确定该删时才合并执行:
# 第一步
ls -l
# 第二步:
find ./* -user root
# 第三步:
find ./* -user root -print0
# 第四步:合并命令正式执行删除操作
find ./* -user root -print0 | xargs -0 rm -rf
方法2: 不要轻易执行rm -rf删除操作,若删除就后悔莫及了
find ./* -user root -exec ls -l {} +
find ./* -user root -exec rm -rf {} +
方法3:此方法不可靠,容易删错文件
step 1:
root@tdar-srv:/home/decisionmaker/.vscode# ls -al
total 172
drwxrwxr-x 17 decisionmaker decisionmaker 4096 9月 18 21:20 .
drwxr-xr-x 29 decisionmaker decisionmaker 4096 9月 18 21:37 ..
-rw-rw-r-- 1 decisionmaker decisionmaker 984 9月 18 20:50 argv.json
drwxr-xr-x 2 root root 4096 9月 18 21:17 Backups
drwx------ 3 root root 4096 9月 18 21:17 blob_storage
drwx------ 3 root root 4096 9月 18 21:18 Cache
drwxr-xr-x 3 root root 4096 9月 18 21:17 CachedData
drwxr-xr-x 2 root root 4096 9月 18 21:17 CachedExtensions
drwx------ 4 root root 4096 9月 18 21:17 'Code Cache'
-rw------- 1 root root 20480 9月 18 21:18 Cookies
-rw------- 1 root root 0 9月 18 21:18 Cookies-journal
drwx------ 2 root root 4096 9月 18 21:17 'Crash Reports'
drwx------ 2 root root 4096 9月 18 21:17 Dictionaries
drwxrwxr-x 3 decisionmaker decisionmaker 4096 9月 18 20:50 extensions
drwx------ 2 root root 4096 9月 18 21:17 'exthost Crash Reports'
drwx------ 2 root root 4096 9月 18 21:17 GPUCache
-rw-r--r-- 1 root root 2 9月 18 21:17 languagepacks.json
drwx------ 3 root root 4096 9月 18 21:17 'Local Storage'
drwxr-xr-x 3 root root 4096 9月 18 21:17 logs
-rw-r--r-- 1 root root 36 9月 18 21:17 machineid
-rw------- 1 root root 365 9月 18 21:18 'Network Persistent State'
-rw-r--r-- 1 root root 446 9月 18 21:17 rapid_render.json
drwx------ 2 root root 4096 9月 18 21:20 'Session Storage'
-rw-r--r-- 1 root root 59724 9月 18 21:17 storage.json
-rw------- 1 root root 406 9月 18 21:18 TransportSecurity
drwxr-xr-x 4 root root 4096 9月 18 21:17 User
step 2:
root@tdar-srv:/home/decisionmaker/.vscode# ls -al | grep root
drwxr-xr-x 2 root root 4096 9月 18 21:17 Backups
drwx------ 3 root root 4096 9月 18 21:17 blob_storage
drwx------ 3 root root 4096 9月 18 21:18 Cache
drwxr-xr-x 3 root root 4096 9月 18 21:17 CachedData
drwxr-xr-x 2 root root 4096 9月 18 21:17 CachedExtensions
drwx------ 4 root root 4096 9月 18 21:17 Code Cache
-rw------- 1 root root 20480 9月 18 21:18 Cookies
-rw------- 1 root root 0 9月 18 21:18 Cookies-journal
drwx------ 2 root root 4096 9月 18 21:17 Crash Reports
drwx------ 2 root root 4096 9月 18 21:17 Dictionaries
drwx------ 2 root root 4096 9月 18 21:17 exthost Crash Reports
drwx------ 2 root root 4096 9月 18 21:17 GPUCache
-rw-r--r-- 1 root root 2 9月 18 21:17 languagepacks.json
drwx------ 3 root root 4096 9月 18 21:17 Local Storage
drwxr-xr-x 3 root root 4096 9月 18 21:17 logs
-rw-r--r-- 1 root root 36 9月 18 21:17 machineid
-rw------- 1 root root 365 9月 18 21:18 Network Persistent State
-rw-r--r-- 1 root root 446 9月 18 21:17 rapid_render.json
drwx------ 2 root root 4096 9月 18 21:20 Session Storage
-rw-r--r-- 1 root root 59724 9月 18 21:17 storage.json
-rw------- 1 root root 406 9月 18 21:18 TransportSecurity
drwxr-xr-x 4 root root 4096 9月 18 21:17 User
step 3:
root@tdar-srv:/home/decisionmaker/.vscode# ls -al | grep root | awk '{print $9}'
Backups
blob_storage
Cache
CachedData
CachedExtensions
Code
Cookies
Cookies-journal
Crash
Dictionaries
exthost
GPUCache
languagepacks.json
Local
logs
machineid
Network
rapid_render.json
Session
storage.json
TransportSecurity
User
step 4:
root@tdar-srv:/home/decisionmaker/.vscode# ls -al | grep root | awk '{print $9}' | xargs
Backups blob_storage Cache CachedData CachedExtensions Code Cookies Cookies-journal Crash Dictionaries exthost GPUCache languagepacks.json Local logs machineid Network rapid_render.json Session storage.json TransportSecurity User
step 5:
root@tdar-srv:/home/decisionmaker/.vscode# ls -al | grep root | awk '{print $9}' | xargs rm -rf
猜你喜欢
- 2025-06-10 Visual Studio Code 扩展介绍 - SVG
- 2025-06-10 VS Code 1.39 发布,Web 版 VS Code 可能不远了
- 2025-06-10 我在用的软件和服务清单(我在用的软件和服务清单怎么删除)
- 2025-06-10 vscode+cline\roo code+deepseek(vscode接入本地deepseek)
- 2025-06-10 Flutter Widget IDE 预览新进展(flutter的widget)
- 2025-06-10 Node.js 开发后台实现基本的增删改查功能
- 2025-06-10 不懂技术的产品经理,如何让 AI 码农帮敲代码?
- 2025-06-10 快速清理 .NET 项目文件夹中不需要的文件和文件夹
- 2025-06-10 Web3教程:使用 Solidity 构建 Web3 应用程序(1)
- 2025-06-10 ubuntu24.04 vscode调用 c++ opencv报错问题
- 最近发表
-
- 一文讲透支付宝沙箱的基本应用(支付宝沙箱是干什么的)
- 管理系统 UI 设计,怎样让操作效率提升 50%?
- 哎?你的Python代码怎么这么像TypeScript
- web前端培训需要多少时间(web前端培训需要多少时间完成)
- mongodb/redis/neo4j 如何自己打造一个 web 数据库可视化客户端?
- 大雨暴雨!考生注意,昆明将迎强降雨,最强时段在→
- 用Python写了一个上课点名系统(附源码)(自制考勤系统)
- 在uniapp中实现3D模型展示:基于Three.js的组件开发实践
- 细聊single-spa + vue来实现前端微服务项目
- springboot+Neo4j:快速搭建自己的知识图谱可视化构建平台
- 标签列表
-
- 向日葵无法连接服务器 (32)
- git.exe (33)
- vscode更新 (34)
- dev c (33)
- git ignore命令 (32)
- gitlab提交代码步骤 (37)
- java update (36)
- vue debug (34)
- vue blur (32)
- vscode导入vue项目 (33)
- vue chart (32)
- vue cms (32)
- 大雅数据库 (34)
- 技术迭代 (37)
- 同一局域网 (33)
- github拒绝连接 (33)
- vscode php插件 (32)
- vue注释快捷键 (32)
- linux ssr (33)
- 微端服务器 (35)
- 导航猫 (32)
- 获取当前时间年月日 (33)
- stp软件 (33)
- http下载文件 (33)
- linux bt下载 (33)