Introduction
When opening files on Linux, how many of you immediately use cat?
cat test.txt It's convenient and easy to use, but have you ever had your screen freeze when opening a large file? 😄
The drawbacks of cat include:
- You can't search for text
- It outputs everything at once
However, less can solve all of these problems.
Use less
I actively use less instead of cat when opening files. Here's how to use it:
less test.txt This makes a huge difference. I find it especially convenient when viewing logs.
Basic Operations
These are the basic commands you need to remember:
-
SPACE: Scroll down -
b: Scroll up -
g: Go to the beginning -
G: Go to the end -
/search_word: Search for text -
q: Exit
Conclusion
-
catis a command for outputting files -
lessis a command for reading files
If you're currently using cat by default, please try less once. You'll be amazed at how much more comfortable it is!
