Question: I can use less or more pagers to view a file. How do I start an editor (such as vi or other text editor) to edit the current file without leaving the less or more pager command?
Answer: You can always start up an editor immediately to edit the current file being viewed. This will save some time and command typing. The editor is taken from the environment variable VISUAL if defined, or EDITOR if VISUAL is not defined, or defaults to "vi" if neither VISUAL nor EDITOR is defined. I suggest you define your EDITOR first, enter:
$ export EDITOR=vim
OR
$ echo 'export EDITOR=vim' >> ~/.bash_profile
Now open any file using more or less pager:
$ less myfile.txt
OR
$ more ~/some.conf
Now, to edit a file, hit v key from keyboard. This will start up an editor at current line and file.
Further readings:
- man page less and more
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- My 10 UNIX Command Line Mistakes
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
- Email FAQ to a friend
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: 11/1/08



{ 2 comments… read them below or add one }
when you use less for more to view at that time you want edit first press ‘v’ then ‘i’
Great tip thank you. I heard about this on the Lottalinuxlinks podcast.