vim如何修改只读文件 小咪咪 2022-05-09 10:22 240阅读 0赞 当我们使用vim编辑类似于/etc/network/interfaces这样的文件的时候总是会遇到权限问 题不能保存,原因是所有的配置文件的权限只属于root。 那么怎样直接以root权限直接vim 这些文件? 方法是: 结合sudo和tee两个命令来实现: w !sudo tee % 解释如下: :w – Write a file. !sudo – Call shell sudo command. tee – The output of write (vim :w) command redirected using tee. % – is nothing but current file name \--------------------- 本文来自 摇曳单车 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/weixin\_39169700/article/details/79204353?utm\_source=copy
还没有评论,来说两句吧...