Detailed explanation of Linux less command examples

Detailed explanation of Linux less command examples

less file name View File
less file name | grep -n search content Filter and display according to content and display line numbers
less + line number g file name View the file and locate a line
d Scroll down
u Page up
g Jump to first line
G Jump to bottom
? Find content Look up
/ Search content Find down
n Next
N Previous
q Exit less command

Here are some specific examples:

1. Open the file less catalina.out

2. View the file and display the line number less -N catalina.out

3. Locate a line (here, line 10) less +10g catalina.out

This is the 10th row.

You can verify by displaying the line number, less -N +10g catalina.out

4. After opening the file, search for content in it

Find the timestamp 2018-07-06 15:24:00,025 and enter the command

/2018-07-06 15:24:00,025

The found content will be automatically highlighted, followed by n for the next one and N for the previous one.

Same for searching upwards? Find content

Finally, don't forget to exit the less command with q

This is the end of this article about the detailed explanation of the linux less command examples. For more related linux less command details, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

<<:  The problem of Vue+tsx using slot is not replaced

>>:  Solution to mysql ERROR 1045 (28000) problem

Recommend

Implementation of navigation bar and drop-down menu in CSS

1. CSS Navigation Bar (1) Function of the navigat...

Essential conditional query statements for MySQL database

Table of contents 1. Basic grammar 2. Filter by c...

Test and solution for MySQL's large memory usage and high CPU usage

After the changes: innodb_buffer_pool_size=576M -...

Steps to set up Windows Server 2016 AD server (picture and text)

Introduction: AD is the abbreviation of Active Di...

Basic usage knowledge points of mini programs (very comprehensive, recommended!)

Table of contents What to do when registering an ...

How to reset the root password in Linux mysql-5.6

1. Check whether the MySQL service is started. If...

How to determine if the Linux system is installed on VMware

How to determine whether the current Linux system...

Vue implements small form validation function

This article example shares the specific code of ...

Native JS to achieve blinds special effects

This article shares a blinds special effect imple...

HTML hyperlink a tag_Powernode Java Academy

Anyone who has studied or used HTML should be fam...

JavaScript to achieve window display effect

This article shares the specific code of JavaScri...

Why MySQL chooses Repeatable Read as the default isolation level

Table of contents Oracle Isolation Levels MySQL I...