Why has the behavior of the `more` command changed?

,

I just upgraded to Fedora 36 and it seems the more command has changed. On Fedora 35 (and prior) the command “more /etc/fedora-release” would display “Fedora release nn (xxx)” and then the $ prompt:

 $ more /etc/fedora-release
 Fedora release 35 (Thirty Five)
 $

On Fedora 35 it displays a full page with many blank lines an EOF at the bottom and it requires a Q to get back to the $ prompt:

 $ more /etc/fedora-release
 Fedora release 36 (Thirty Six)

 ...
 (END) (enter q)
 $

Worse is that if I use the -s option, the more command hangs:

 $more /etc/fedora-release -s
 Fedora release 36 (Thirty Six)

It does not respond to a break/interrupt . I have to close/kill the “more” process to get back to the $ prompt.

Is there any fix for the more command?

1 Like

The more command is designed to produce a page (screen) of data from a file at a time, and allows paging down to see the data at the users pace for reading.

AFAIK it has always used ‘enter’ to page down and ‘q’ to quit. I am not an expert with more since the more advanced command ‘less’ allows moving both up and down within the displayed info and has been my go-to for many many years. ‘less’ allows navigating with enter, up & down arrows, and paging with page up & page down.

Both use the ‘q’ to exit the displayed info.

2 Likes

I see that more has the option -e that does:

       -e, --exit-on-eof
           Exit on End-Of-File, enabled by default if not executed on terminal.

The version in F35 is 2.37.4 and in F36+ it’s 2.38+:

https://koji.fedoraproject.org/koji/packageinfo?packageID=34

The changelog for 2.38 says:

  • POSIX compliance patch preventing exit on EOF without -e [Ian Jones]

So, the default behaviour seems to have changed (corrected for POSIX compliance).

The F35 behaviour would be replicated using more -e .... You can use an alias to always call it with -e by adding this to your ~/.bashrc if you’re using bash:

alias more="more -e"

I’m not seeing this on my Fedora 37 here, but it’s a patch version ahead of F36 from the looks of it. Let’s start with some info: what version of the package are you using?

which more
rpm -qf /usr/bin/more

I think you mean 36 here?

As far as the original question. Can ‘more’ be reverted to the form where an output of less than a page return to a command prompt.
Answer:
Very easily.
edit ~/.bashrc and add a line alias more="more -e"

This command $more /etc/fedora-release -s is invalid since it places the -s option after the file name, not before, thus is trying to find a file named ‘-s’. This is likely the cause of needing to use the ctrl-C. When I use more with 2 different file names it displays the first file and waits for an exit of that file before it will display the second.

$ more -e -s /etc/fedora-release /etc/os-release 
::::::::::::::
/etc/fedora-release
::::::::::::::
Fedora release 37 (Thirty Seven)
::::::::::::::
/etc/os-release
::::::::::::::
NAME="Fedora Linux"
VERSION="37 (Workstation Edition)"
ID=fedora
VERSION_ID=37
VERSION_CODENAME=""
PLATFORM_ID="platform:f37"
PRETTY_NAME="Fedora Linux 37 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:37"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f37/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=37
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=37
SUPPORT_END=2023-11-14
VARIANT="Workstation Edition"
VARIANT_ID=workstation

Although there are no blank lines in the second file to ‘squeeze’ the -e exited as soon as the last file was displayed in full and the -s worked with no errors.

Here is the version of the package

$ rpm -qf /usr/bin/more
util-linux-core-2.38-1.fc36.x86_64

You are correct , I did mean Fedora 36 with regards to displaying blank lines.

more -e does give me the behaviour that I am used to ie no EOF unless there is nore than one page of information.

When I use more on RedHat or AIX or any Fedora prior to Fedora 36, it would not fill the screen with blank lines and display EOF and expect a q to quit one a one line file. If there is more than one page/screen of information in the file then it shows “–More–(2%)” and awaits input( shows one more line and space shows the next page/screen. When you get to bottom it ends without displaying EOF and expecting a q to quit 0- ie in all my past experience with the more command it seemed to run as if the -e option had been included.

Seems quite likely that there was an alias created at some point so that a command line ‘more’ actually was aliased and executed as ‘more -e’. Some how that alias may have been removed, but the desired effect may easily be restored by creating your own alias as noted above.

If you were to run cat ~/.bashrc do you see aliases listed there?
If you run alias do you see a list of aliases that are in effect for you? (I have 15 - 20 aliases listed)
It is quite common for users to have an alias for a command so that commonly used options are automatically added.