Use less command to view long text documents

Share this post to your friends !

This entry is part 3 of 6 in the series Linux commands: Part 3 - Exploring the system
Use less command to view long text documents
5 (100%) 1 vote[s]

WriteBash - In the Linux system, there are very long text files, such as system log files. To be able to view long text files easily, you can use the less command.

What is the less command?

The less command is a program designed to replace a previously existing command on Unix that is more. The word less comes from the phrase “less is more“, which is the motto of modern architects.

Like the more command, the less command lets you view the content of a text file as pages, which is crucial when you want to see the content of a very long text file. Other than the more command can only view the page forward, the less command can view the page backward.

Use the less command to view long text

Less command is very simple to use, you just need to type the command and followed by the file name (or absolute path to the file).

use-less-command-view-long-text-documents Use less command to view long text documents

The table below lists the most common keyboard commands used by less:

KeyAction
Page Up or bScroll back one page
Page Down or spaceScroll forward one page
Up ArrowScroll up one line
Down ArrowScroll down one line
GMove to the end of the text file
1G or gMove to the beginning of the text file
/charactersSearch forward to the next occurrence of characters
nSearch for the next occurrence of the previous search
hDisplay help screen
qQuit less

Conclusion

For long text files on linux, you will often have to use the less command and hopefully through this article, those who are new to Linux will use it more easily.

Continue reading the series«« Previous part: Use “file” command to determine the type of fileNext part: Create links with ln command »»
If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.


Share this post to your friends !
If you appreciate what we share in this blog, you can support us by:
  1. Stay connected to: Facebook | Twitter | Google Plus | YouTube
  2. Subscribe email to recieve new posts from us: Sign up now.
  3. Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
  4. Become a Supporter - Make a contribution via PayPal.
  5. Support us by purchasing Ribbon Lite Child theme being using on this website.

We are thankful for your support.

single post bottom banner
«« »»

Got something to say? Join the discussion

Please keep in mind that all comments are subject to our Comment Policy. Your email address will not be published.
This site uses Akismet to reduce spam. Learn how your comment data is processed.