Loading [MathJax]/jax/output/CommonHTML/config.js
前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >Mac中安全地使用rm命令

Mac中安全地使用rm命令

作者头像
草堂笺
发布于 2019-12-20 09:47:07
发布于 2019-12-20 09:47:07
1.9K00
代码可运行
举报
文章被收录于专栏:代码如诗代码如诗
运行总次数:0
代码可运行

.example_responsive_1 { width: 200px; height: 50px; } @media(min-width: 290px) { .example_responsive_1 { width: 270px; height: 50px; } } @media(min-width: 370px) { .example_responsive_1 { width: 339px; height: 50px; } } @media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 50px; } } @media(min-width: 720px) { .example_responsive_1 { width: 655px; height: 50px; } } @media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 50px; } } (adsbygoogle = window.adsbygoogle || []).push({});

Mac中安全地使用rm命令

目录

让rm命令将文件(夹)移入废纸篓, 安全地删除文件. 文章地址: https://cloud.tencent.com/developer/article/1557582

关键词

  • rm: 删除命令, 文件一旦通过rm命令删除, 则无法恢复, 所以必须格外小心地使用该命令.
  • trash: OSX下的小型命令行程序, 用于将文件或文件夹移动到废纸篓.

关键词

  • rm: 删除命令, 文件一旦通过rm命令删除, 则无法恢复, 所以必须格外小心地使用该命令.
  • trash: OSX下的小型命令行程序, 用于将文件或文件夹移动到废纸篓.

前言

终端操作中经常会使用到rm甚至rm -rf命令删除一些文件, 这种方式删除的文件不会出现在废纸篓中, 若出现误删的情况, 找回文件是个麻烦事. 所以需要改变rm命令, 让它将文件移入废纸篓.

终端中如何将文件移入回收站

trash is a small command-line program for OS X that moves files or folders to the trash.

trash命令可以实现将文件(夹)移入废纸篓, 并且支持指定使用-F指定使用Finder来删除文件(这种方式支持放回原处操作)

安装trash命令

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
$ brew install trash
$ trash -F [file-name]

如果没有安brew, 安装参考官网即可: https://brew.sh

rm设置为trash命令的别名

打开~/.bash_profile文件, 并添加一行alias rm="trash -F", 重新打开终端即可生效 (也可执行source ~/.bash_profile使配置生效).

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
alias rm="trash -F"

参考文献

© 2019, 朴瑞卿.

版权声明

代码语言:txt
AI代码解释
复制
 本文发布于[朴瑞卿的博客](https://blog.piaoruiqing.com/), 允许非商业用途转载, 但转载必须保留原作者[朴瑞卿](https://blog.piaoruiqing.com/) 及链接:[https://blog.piaoruiqing.com](https://blog.piaoruiqing.com/).      如有授权方面的协商或合作, 请联系邮箱: [piaoruiqing@gmail.com](https://blog.piaoruiqing.com/mailto:piaoruiqing@gmail.com).
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
用了这么久HTTP, 你是否了解Content-Length和Transfer-Encoding ?
.example_responsive_1 { width: 200px; height: 50px; } @media(min-width: 290px) { .example_responsive_1 { width: 270px; height: 50px; } } @media(min-width: 370px) { .example_responsive_1 { width: 339px; height: 50px; } } @media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 50px; } } @media(min-width: 720px) { .example_responsive_1 { width: 655px; height: 50px; } } @media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 50px; } } (adsbygoogle = window.adsbygoogle || []).push({});
草堂笺
2019/12/20
8140
用了这么久HTTP, 你是否了解Content-Length和Transfer-Encoding ?
Kubernetes(二) 应用部署
.example_responsive_1 { width: 200px; height: 50px; } @media(min-width: 290px) { .example_responsive_1 { width: 270px; height: 50px; } } @media(min-width: 370px) { .example_responsive_1 { width: 339px; height: 50px; } } @media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 50px; } } @media(min-width: 720px) { .example_responsive_1 { width: 655px; height: 50px; } } @media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 50px; } } (adsbygoogle = window.adsbygoogle || []).push({});
草堂笺
2019/12/20
1K0
Kubernetes(二) 应用部署
记一次Redis连接超限排查
.example_responsive_1 { width: 200px; height: 50px; } @media(min-width: 290px) { .example_responsive_1 { width: 270px; height: 50px; } } @media(min-width: 370px) { .example_responsive_1 { width: 339px; height: 50px; } } @media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 50px; } } @media(min-width: 720px) { .example_responsive_1 { width: 655px; height: 50px; } } @media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 50px; } } (adsbygoogle = window.adsbygoogle || []).push({});
草堂笺
2019/12/20
1.6K0
记一次Redis连接超限排查
MySQL查漏补缺
.example_responsive_1 { width: 200px; height: 50px; } @media(min-width: 290px) { .example_responsive_1 { width: 270px; height: 50px; } } @media(min-width: 370px) { .example_responsive_1 { width: 339px; height: 50px; } } @media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 50px; } } @media(min-width: 720px) { .example_responsive_1 { width: 655px; height: 50px; } } @media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 50px; } } (adsbygoogle = window.adsbygoogle || []).push({});
草堂笺
2019/12/20
2.4K0
开放API网关实践(二) —— 重放攻击及防御
.example_responsive_1 { width: 200px; height: 50px; } @media(min-width: 290px) { .example_responsive_1 { width: 270px; height: 50px; } } @media(min-width: 370px) { .example_responsive_1 { width: 339px; height: 50px; } } @media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 50px; } } @media(min-width: 720px) { .example_responsive_1 { width: 655px; height: 50px; } } @media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 50px; } } (adsbygoogle = window.adsbygoogle || []).push({});
草堂笺
2019/12/20
2K0
开放API网关实践(二) —— 重放攻击及防御
Kubernetes(三) 如何从外部访问服务
.example_responsive_1 { width: 200px; height: 50px; } @media(min-width: 290px) { .example_responsive_1 { width: 270px; height: 50px; } } @media(min-width: 370px) { .example_responsive_1 { width: 339px; height: 50px; } } @media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 50px; } } @media(min-width: 720px) { .example_responsive_1 { width: 655px; height: 50px; } } @media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 50px; } } (adsbygoogle = window.adsbygoogle || []).push({});
草堂笺
2019/12/20
2.9K0
我是如何通过Nginx日志实时封禁风险IP的
.example_responsive_1 { width: 200px; height: 50px; } @media(min-width: 290px) { .example_responsive_1 { width: 270px; height: 50px; } } @media(min-width: 370px) { .example_responsive_1 { width: 339px; height: 50px; } } @media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 50px; } } @media(min-width: 720px) { .example_responsive_1 { width: 655px; height: 50px; } } @media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 50px; } } (adsbygoogle = window.adsbygoogle || []).push({});
草堂笺
2019/12/20
1.2K0
我是如何通过Nginx日志实时封禁风险IP的
Kubernetes(一) 跟着官方文档从零搭建K8S
.example_responsive_1 { width: 200px; height: 50px; } @media(min-width: 290px) { .example_responsive_1 { width: 270px; height: 50px; } } @media(min-width: 370px) { .example_responsive_1 { width: 339px; height: 50px; } } @media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 50px; } } @media(min-width: 720px) { .example_responsive_1 { width: 655px; height: 50px; } } @media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 50px; } } (adsbygoogle = window.adsbygoogle || []).push({});
草堂笺
2019/12/20
2.1K0
Kubernetes(一) 跟着官方文档从零搭建K8S
开放API网关实践(三) —— 限流
.example_responsive_1 { width: 200px; height: 50px; } @media(min-width: 290px) { .example_responsive_1 { width: 270px; height: 50px; } } @media(min-width: 370px) { .example_responsive_1 { width: 339px; height: 50px; } } @media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 50px; } } @media(min-width: 720px) { .example_responsive_1 { width: 655px; height: 50px; } } @media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 50px; } } (adsbygoogle = window.adsbygoogle || []).push({});
草堂笺
2019/12/20
1.3K0
开放API网关实践(三) —— 限流
秒杀场景实践之抢红包(一) —— 常用解决方案
.example_responsive_1 { width: 200px; height: 50px; } @media(min-width: 290px) { .example_responsive_1 { width: 270px; height: 50px; } } @media(min-width: 370px) { .example_responsive_1 { width: 339px; height: 50px; } } @media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 50px; } } @media(min-width: 720px) { .example_responsive_1 { width: 655px; height: 50px; } } @media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 50px; } } (adsbygoogle = window.adsbygoogle || []).push({});
草堂笺
2019/12/20
1.3K0
使用 trash 避免 rm -rf 悲剧
昨晚做了一个令人痛心疾首的操作,rm -rf something,把我个人电脑里的重要文件夹给删掉了,懵逼了半天才缓过来。还好是个人文件,不对公司造成影响。这件事也让我意识到 rm -rf 确实是个高风险操作,文件备份也是重中之重。
超超不会飞
2020/09/18
1.4K0
应对冰桶算法的折腾再次领教了Adsense的强大!
百度最近的算法调整非常的频繁,特别是针对移动端的冰桶算法4.0的强势登场感觉影响更大,因为冰桶算法4.0主要是针对移动端广告位置、尺寸的,基本上可以理解为是打击移动端广告泛滥的,所有尺寸过大的以及对内容有遮挡的都会被降权,具体的大家可以看看图1、图2两张百度官方认为是标准正确的移动端广告范例来对比了解一下就明白了。
明月登楼的博客
2019/05/15
8710
应对冰桶算法的折腾再次领教了Adsense的强大!
Mac 技术篇-应用程序被锁定无法进行卸载问题解决方法,文件、文件夹被锁定无法移入废纸篓处理方法,卡巴斯基被锁定如何进行卸载演示
有的直接可以取消勾选已锁定,这样再卸载或删除就直接可以了。 不能勾选的我们可以直接在终端控制台指定下面的命令就好了: sudo rm -rf 被锁定的文件、文件夹路径 不知道路径怎么写的可以直接把文件或文件夹拖进终端就 ok 了。
小蓝枣
2021/12/01
9.8K1
Mac 技术篇-应用程序被锁定无法进行卸载问题解决方法,文件、文件夹被锁定无法移入废纸篓处理方法,卡巴斯基被锁定如何进行卸载演示
rem适配布局
rem 是根 em(root em)的缩写,是相对于根元素(html 元素)的字体大小。
赤蓝紫
2023/01/02
1.4K0
rem适配布局
前端响应式布局为什么是个坑?
响应式设计:Responseive design,就是一个网站,一套代码能在所有终端能够正常展示,并不是为每个终端做一个特定版本,响应式是为解决移动互联网浏览器而诞生的。
呆呆
2021/09/30
9550
CSS媒体查询_css网页
min-width: 800px 表示当屏幕宽度大于等于800px时,该样式生效。
全栈程序员站长
2022/11/01
1.7K0
移动web开发(5)之rem适配布局
刚刚又把携程的案例做了一遍,发现还是有问题的,虽然说子盒子为弹性容器的时候,虽然是没有行内元素和块级元素的区别了,但是当里面没有内容的时候,设置了大小也还是不生效的.案例自己做的时候发现也没那么麻烦啦,只是刚学习了新的知识点 , 所以写起来还是比较慢的.
y191024
2022/09/20
1.2K0
移动web开发(5)之rem适配布局
linux每日命令(6):rm命令
rm是常用的命令,该命令的功能为删除一个目录中的一个或多个文件或目录,它也可以将某个目录及其下的所有文件及子目录均删除。对于链接文件,只是删除了链接,原有文件均保持不变。
用户1214487
2018/11/29
2.4K0
移动web开发之rem适配布局
比如,根元素(html)设置font-size=12px;非根元素设置width:2rem;则换成px表示就是24px.
梨涡浅笑
2020/10/27
1.9K0
linux常用命令之rm命令
rm是常用的命令,该命令的功能为删除一个目录中的一个或多个文件或目录,它也可以将某个目录及其下的所有文件及子目录均删除。对于链接文件,只是删除了链接,原有文件均保持不变。
用户8832503
2022/03/02
1.4K0
相关推荐
用了这么久HTTP, 你是否了解Content-Length和Transfer-Encoding ?
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验