方法一:
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
版權聲明:【原址】:http://blog.csdn.net/u014587769?viewmode=contents https://blog.csdn.net/u014587769/article/details/73330463