Thursday 24 June 2021

more command in Linux | Linux for Beginners 2021

 


more command in Linux | Linux for Beginners 2021

more command is used to view the text files in the command prompt, displaying one screen at a time in case the file is large (For example log files). The more command also allows the user do scroll up and down through the page. The syntax along with options and command is as follows. Another application of more is to use it with some other command after a pipe. When the output is large, we can use more command to see output one by one.

Syntax:

more [-options] [-num] [+/pattern] [+linenum] [file_name]

·         [-options]: any option that you want to use in order to change the way the file is displayed. Choose any one from the followings: (-d, -l, -f, -p, -c, -s, -u)

·         [-num]: type the number of lines that you want to display per screen.

·         [+/pattern]: replace the pattern with any string that you want to find in the text file.

·         [+linenum]: use the line number from where you want to start displaying the text content.

·         [file_name]: name of the file containing the text that you want to display on the screen.

While viewing the text file use these controls:

Enter key: to scroll down line by line.
Space bar: To go to the next page.
b key: To go to back one page.

 

 

Options:

  • -d : Use this command in order to help the user to navigate. It displays “[Press space to continue, ‘q’ to quit.]” and displays “[Press ‘h’ for instructions.]” when wrong key is pressed.

Example:

more -d sample.txt

Description: https://media.geeksforgeeks.org/wp-content/uploads/snap1.jpg

  • -f : This option does not wrap the long lines and displays them as such.

Example:

more -f sample.txt

Description: https://media.geeksforgeeks.org/wp-content/uploads/snap2.jpg

  • -p : This option clears the screen and then displays the text.

Example:

more -p sample.txt

Description: https://media.geeksforgeeks.org/wp-content/uploads/snap3.jpg

  • -c : This command is used to display the pages on the same area by overlapping the previously displayed text.

Example:

more -c sample.txt

Description: https://media.geeksforgeeks.org/wp-content/uploads/snap4.jpg

  • -s : This option squeezes multiple blank lines into one single blank line.

Example:

more -s sample.txt

Description: https://media.geeksforgeeks.org/wp-content/uploads/snap5.jpg

  • -u : This option omits the underlines.

Example:

more -u sample.txt

  • +/pattern : This option is used to search the string inside your text document. You can view all the instances by navigating through the result.

Example:

more +/reset sample.txt

Description: https://media.geeksforgeeks.org/wp-content/uploads/snap6.jpg

  • +num : This option displays the text after the specified number of lines of the document.

Example:

more +30 sample.txt

Description: https://media.geeksforgeeks.org/wp-content/uploads/snap7.jpg

Using more to Read Long Outputs: We use more command after a pipe to see long outputs. For example, seeing log files, etc.

cat a.txt | more

 

 

Hope you understand about cat command if you have any query you can comment me below in comment section. Thanks for watching see you again in next video. Bye

 

 

more command in Linux | Linux for Beginners 2021,

more command in aix,

more command in dos,

more command in hindi,

more command in linux end of file,

more command in ms dos,

more command in powershell,

more command in windows

more command with line number,

more commands addon mcpe,

more commands in minecraft,

more commands mod minecraft

more commands mod slime rancher,

more commands mod,

more commands mod,

more commands plugin,

more commands,

 

No comments:

Post a Comment

If you have any doubt please let me know..