Rakesh Gautam
Answered On : Jul 5th, 2005
vi filename
e.g vi abc.txt but you cannot write to it
easy way if file is small
cat filename and contents is display on screen
Login to rate this answer.
Ramakrishna Choudarapu
Answered On : Nov 4th, 2005
view is a better option. It will not allow writing to a file normally, unless done forcefully like "wq!" or "x!"...
Login to rate this answer.
"vi -R filename"

1 User has rated as useful.
Login to rate this answer.
Anuradha
Answered On : Aug 30th, 2006
In a shell script, you can open a file in read only mode by using O_RDONLYSyntax - open(,O_RDONLY)
Login to rate this answer.
sandhiya
Answered On : Oct 17th, 2006
more is the best option.
Login to rate this answer.
more
cat
less
Login to rate this answer.
rajugowda
Answered On : Jun 18th, 2007
To Open read only file in Unix
Vi
or Cat
The Question is not clearly being told that which file should open, means - already created file or newly creating file.
Login to rate this answer.
If you mean open a file in Unix which has read-only permission
... then you open it the same way you open any other file. The system will simply prevent you from writing to it.
If you mean open a file in Unix such that you can not write to the file, even though you otherwise would be allowed because you do have write permission ...
... then it depends on what mechanism you use to open the file. Others have already answered for opening with the "vi" editor. Other programs, such as "emacs", or other text editors, would have other ways.
Login to rate this answer.
The best way is to open a read only file. use SUDO, because you do not know what or who is the owner of the file in this scenario.
Login to rate this answer.
Raj
Answered On : Jun 14th, 2012
The answer to your question depends on what type of file you want to read and what you what to do with the file after reading it.
Login to rate this answer.
Sudhir
Answered On : Sep 22nd, 2012
less filename
Login to rate this answer.
tushar makkar
Answered On : Sep 24th, 2012
suppose the name of read only file is t.txt
chmod u+rw t.txt
gedit t.txt
Login to rate this answer.
SaintHax
Answered On : Oct 4th, 2012
Anything that opens a file, can open a read only file: cat, more, less, awk, pg, et all. The chmod command you put does not make a file read only, it makes it read/write for the user/owner.
Login to rate this answer.
Nice Thomas
Answered On : Jan 2nd, 2013
Using vi editor. Read only files can be opened without any issues
Login to rate this answer.