w ! sudo tee%
来源:互联网 发布:怎样投诉淘宝卖家客服 编辑:程序博客网 时间:2024/05/21 08:47
原文是这样解释这个命令的:
在vim中保存正在编辑的文件而不需要必要的权限。
(Save a file you edited in vim without the needed permissions)
下面我们就分析下这条命令是怎样做到保存文件而不需要必要的权限的
:w !sudo tee %
man vim就会发现
百分号(“%”)代表当前文件名
根据man vim的提示:
:[range]w[rite] !{cmd} Execute {cmd} with [range] lines as standard input
(note the space in front of the ‘!’). {cmd} is
executed like with “:!{cmd}”, any ‘!’ is replaced with
the previous command
“:w !sudo tee %”这条命令的含义是把当前编辑的文件的内容当做标准输入输入到命令sudo tee 文件名里去
也就是sudo保存为当前文件名
- :w !sudo tee %
- w ! sudo tee%
- :w !sudo tee %
- :w ! sudo tee %
- 关于vim的:w !sudo tee % > /dev/null 命令
- 在linux中对一个没有权限的文件强制修改保存的命令:w !sudo tee %
- su/sudo/id/whoami/who/w/passwd
- tee
- tee
- TEE
- echo '/tmp/core_%e.%p' | sudo tee /proc/sys/kernel/core_pattern
- TEE: OP-TEE
- w
- w
- w
- w
- w
- w
- jquery 克隆行
- linux安装并启动ssh服务
- 用PHP远程修改服务器密码和hostname
- win7 下cmd 运sqlplus 报错:无法初始化 Oracle 调用界面 .
- 随手记下通过API获取LOV名称和UUID的便捷方式
- w ! sudo tee%
- C#跨线程的给空间赋值
- Fixing XSS: A practical guide for developers
- gpio_request gpio_set_value __gpio_set_value
- Android学习之 The connection to adb is down, and a severe error has occured. 解决方法
- 数据库文件移位(一)
- WAF Testing Framework
- javascript 中contentWindow和 frames
- PyQuery Tutorial: Basic HTML Parsing with PyQuery