Command to display text files one screen at a time
You can see the messages log file at less / var / log / messages
.
Generally, I think that you often use less
when checking.
--Preparation of sample file
$ echo aaaaaaa > sample.txt
$ cat sample.txt
aaaaaaa
--Rewriting the sample file
less sample.txt
==========
aaaaaaa
==========
If you press v
with ↑ less
open, it will be in conversion mode as shown in ↓.
aaaaaaa
Added the string test
aaaaaaa
test
Save as : wq
aaaaaaa
test
It returns in the state of less
, so close it.
It has been changed when confirmed
$ cat sample.txt
==========
aaaaaaa
test
==========
There is a possibility that important files will be rewritten with a typo. You can prevent it from being rewritten by using the cat command as shown below.
cat sample.txt | less
By the way, if you press v
with the ↑ command, it will be displayed that you cannot edit as follows.
Recommended Posts