Linux编辑只读文件

来源:互联网 发布:淘宝卖家不给发票投诉 编辑:程序博客网 时间:2024/06/13 06:01

方法零:

sudo gedit fileURL
然后随意操作随意保存。

方法一:

VIM编辑完成之后
命令:w !sudo tee %
输入密码

//二,警告文件已被修改了,并显示出一个选项菜单。//这里按 L键重新将该文件载入缓冲区。//按 O 应该也可以,笔者没有尝试。Press ENTER or type command to continue    W12: Warning: File “/etc/profile” has changed and the buffer was changed in Vim as well    See “:help W12” for more info.    [O]K, (L)oad File:

方法二:

如若没有VIM
可以先查看文件权限
然后修改其为可读可写权限
然后修改文件
然后把权限设置为原来的
这个成功过细节不在详述。

参考:

http://m.blog.csdn.net/champwang/article/details/46823611
http://blog.csdn.net/deng529828/article/details/6031261

原创粉丝点击