I am new to Ubuntu. I know I can open a file using vim in read-only mode by pass the -R
option:
vim -R <filename> //Gives warning if I try to write
However, if I do the same thing with nano, I am able to write files freely:
nano -R <filename> //I can still write
What am I doing wrong? How can I open files in read-only mode using nano?
cat <filename>
-R
has a constant OS-defined or OS-enforced meaning. That's not a valid assumption.-R
and similar flags are defined by each application. That's what happens when you have a thousand different developers and a thousand independent software projects. Ubuntu is a merely distributor ("distro") of upstream Open Source and Free Software projects, and cannot impose a standard upon them.less -iM <filename>
would be my preference. I usealias m=less
withLESS = iMRj5X
in my~/.lesskey
. Along with,
and.
as prev-file and next-file. Viewing files or piping into a pager is so common I want a 1-letter alias for it. (Andm
formore
orless
is fun, and keeps it on a different letter thanls
orl
.)nano
have syntax highlighting?less
has all the other things you mentioned, being designed for viewing text files, with space for page-down since it's not an editor.