How to Open the File in Read Only Mode on Linux

Share this Article :

Question :
How to open a file on read only mode on linux?

Answer :
This command has been tested on Redhat Enterprise linux 6 (RHEL6) server. To open the file with vim in read only mode on linux, you need to run “vim -R” as below. Vim is enhanced version of vi editor that viewing the text file with coloring. “vim -R” is good command if you want to avoid accidentally deleted any important line as in read only.

Example :

[[email protected] ~]# vim -R /etc/passwd

read only mode

Leave a Reply