How Do You Exit a Read Only File in Linux?
Contents Note That Pressing L Seems to Do Pretty Much the Same Thing. the File Will Be Saved but Remains Opened in Vi/Vim for More Editing or Reading. We Can...
Contents
Note that pressing L seems to do pretty much the same thing. The file will be saved but remains opened in Vi/Vim for more editing or reading. We can now exit normally by typing ESC :q! since the file is still opened as read-only.
How do I close a read only file in Linux?
To save a file that’s read-only, use the following command: :wq! The exclamation point after write-quit is to override the read-only status of the file.
Must Read
How do I change a read only file in Linux?
Long Answer
- Log in as the root user: [email protected]:~$ sudo su –
- Open hostname: [email protected]:~# vi /etc/hostname.
- You will see oldName . …
- Open hosts: [email protected]:~# vi /etc/hosts. …
- Similarly to what you did in step 3, change the computer name from oldName to newName . …
- Exit the root user: [email protected]:~# exit.