[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedSeptember 13, 2023

How to use more command in Linux.

How To Use More Command.

In this guide, we look at the Linux more command and demonstrate how you can make the most out of it.

The cat command is a very handy tool when viewing short text files. However, when you have large files, it only gives you the last section of the file that constitutes the last few lines of the file. This compels you to scroll all the way up to start reading the file from the very beginning.

A better approach is to make use of the Linux more command. The command displays one section of the file at a time and allows you to comfortably scroll all the way to the end of the file.

 

Basic Syntax

The Linux more command takes the following syntax:

$ more [ options ] filename

 

Linux more Command Without Any Options

In its basic form, the more command displays the first section of the file. By pressing the “ENTER” key, you can scroll line by line, all the way to the bottom of the file.

Here, we are displaying the /etc/ssh/sshd_config file using the more command:

$ more /etc/ssh/sshd_config

To scroll line by line, just press “ENTER”.

To sift through the configuration file page by page, tap on the “SPACE BAR” key.

 

Linux more Command with the -d Option

With the -d command option, the more command prompts you to either proceed to view the file by pressing the “SPACE” key or simply exit by pressing the “Q” key on the keyboard.

$ more -d /etc/ssh/sshd_config

 

Display First N Lines of a File

In the first two examples, the more command displays the first section of the file. To display the very first 10 lines, for example, run the command below:

$ more -10 /etc/ssh/sshd_config

This displays the first 10 lines of the file, whereupon, you can continue scrolling normally by pressing the “ENTER” key.

 

Squeeze Blank Lines in a File

Multiple blank lines in a file can often be a put-off. If you have a file with multiple blank lines, you can remove them on display by simply using the -s option, as shown below

$ more -s hello.txt

 

Use more Command to Read the Output of Another Command

Additionally, you can pipe the output of the cat command to more command as provided below. This is akin to invoking more command without any command options.

$ cat /etc/ssh/sshd_config | more

Those are some of the most commonly used more command options. For more options, visit the man pages.

$ man more

 

Conclusion:

Viewing large files can be a challenge using the basic cat command or text editors such as nano or vim. The Linux more command allows you to comfortably go over the file line by line or page by page.

Keep reading
How to Install Asterisk on CentOS 7
September 8, 2023

How to Install Asterisk on CentOS 7

How To Install Asterisk On CentOS 7 This tutorial will guide you through the steps required to install Asterisk 15 on CentOS 7. Disable Selinux If SELinux is set to enforcing mode, Asterisk will not function correctly. To disable SELinux security features, open the /etc/selinux/config file and set…

Read article
How to Install R on CentOS 7
September 8, 2023

How to Install R on CentOS 7

How To Install R On CentOS 7 This tutorial will teach you how to install R on CentOS 7 and how to install R packages from the official Comprehensive R Archive Network (CRAN) . Installing R on Centos At the time of writing the latest stable version of R is version 3.5. To install…

Read article
How to Install Google Chrome Web Browser on CentOS 7.
September 8, 2023

How to Install Google Chrome Web Browser on CentOS 7.

How To Install Google Chrome Web Browser On CentOS 7. This tutorial explains how to install the Google Chrome web browser on CentOS 7. The same instructions apply for any RHEL based distribution, including Fedora and Scientific Linux. Installing Google Chrome on CentOS Follow the steps listed…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00