Navigating Text Files with more
Once the more
command is executed, you can use various navigation commands to browse through the file. Here are the most common navigation commands:
Basic Navigation Commands
Command |
Description |
Space |
Displays the next page of the file |
Enter |
Displays the next line of the file |
b |
Displays the previous page of the file |
q |
Quits the more command and returns to the terminal |
Advanced Navigation Commands
In addition to the basic navigation commands, the more
command also provides several advanced options to enhance your file browsing experience.
Searching within the File
You can search for a specific word or phrase within the file using the following command:
/[search_term]
Replace [search_term]
with the word or phrase you want to search for. The more
command will highlight the first occurrence of the search term and allow you to navigate to the next occurrence using the n
command.
Jumping to a Specific Line
To jump to a specific line in the file, you can use the following command:
:n
Replace n
with the line number you want to jump to.
To display information about the file, such as the file name, size, and current position, you can use the following command:
h
This will display a help menu with the available commands and their descriptions.
graph LR
A[Execute "more [filename]"] --> B[Use navigation commands]
B --> C[Space: Next page]
B --> D[Enter: Next line]
B --> E[b: Previous page]
B --> F[q: Quit]
B --> G[/[search_term]: Search]
B --> H[:n: Jump to line n]
B --> I[h: Display help]
By mastering these navigation commands, you can efficiently browse through text files using the more
command in Linux.