---

How to open a file in vim in read-only mode on Linux/Unix

I need of opening necessary files in reading (read-only) mode to avoid accidental editing of files such as /etc/resolv.conf or a large config or programming file on a production server. How do I open files in read-only mode in vim text editor on Linux or Unix-like system?

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis