Error using help command in Karaf console: "Command not found: more"

  • Platform information:
    • Hardware: Raspberry Pi B, ARMv7
    • OS: Raspbian Jessie
    • Java Runtime Environment: java version “1.8.0_121”
    • openHAB version: 2.3.0-SNAPSHOT, build 1220
    • Installation type: manual (installed to /opt/openhab2/

The lack of a more command is causing the help command to fail in the karaf console:

pi@rpi $: ssh openhab@localhost -p 8101
openhab> help
Command not found: more
openhab> help less
less -  file pager
Usage: less [OPTIONS] [FILES]
  -? --help                    Show help
  -e --quit-at-eof             Exit on second EOF
  -E --QUIT-AT-EOF             Exit on EOF
  -F --quit-if-one-screen      Exit if entire file fits on first screen
  -q --quiet --silent          Silent mode
  -Q --QUIET --SILENT          Completely  silent
  -S --chop-long-lines         Do not fold long lines
  -i --ignore-case             Search ignores lowercase case
  -I --IGNORE-CASE             Search ignores all case
  -x --tabs                    Set tab stops
  -N --LINE-NUMBERS            Display line number for each line
     --no-init                 Disable terminal initialization
     --no-keypad               Disable keypad handling

Command not found: more

Can anyone help me on this :wink: ?

I get this

Launching the openHAB runtime...

                          __  _____    ____
  ____  ____  ___  ____  / / / /   |  / __ )
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  |
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/
    /_/                        2.3.0-SNAPSHOT
                               Build #1219

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.

openhab> help
bundle                            | Enter the subshell
bundle:capabilities               | Displays OSGi capabilities of a given bundles.
bundle:classes                    | Displays a list of classes/resources contained in the bundle
bundle:diag                       | Displays diagnostic information why a bundle is not Active
bundle:dynamic-import             | Enables/disables dynamic-import for a given bundle.
bundle:find-class                 | Locates a specified class in any deployed bundle
bundle:headers                    | Displays OSGi headers of a given bundles.
...

Looks like it is working for you just fine. Could you try this command:

openhab> help shell

And see if shell:more is an available command? or perhaps:

openhab> shell:more --help

I do not have the shell:more command available in karaf. The only pager I have is shell:less. It seems the default pager is set to a command which doesn’t exist in my particular case.

openhab> help shell
SUBSHELL
    shell

COMMANDS
    | shell:__directories      |
    | shell:__files            |
    | shell:__usage_completion |
    | shell:addCommand         | Add a command
    | shell:bg                 |
    | shell:break              |
    | shell:cat                |
    | shell:cd                 |
    | shell:clear              |
    | shell:complete           |
    | shell:completion         | Display or change the completion mode on the current console session.
    | shell:continue           |
    | shell:date               |
    | shell:each               |
    | shell:echo               |
    | shell:eval               | Evaluate
    | shell:exec               | Executes system processes.
    | shell:fg                 |
    | shell:format             |
    | shell:getopt             |
    | shell:grep               |
    | shell:head               |
    | shell:history            |
    | shell:if                 |
    | shell:info               | Prints system information.
:
openhab> more -?
less -  file pager
Usage: less [OPTIONS] [FILES]
  -? --help                    Show help
  -e --quit-at-eof             Exit on second EOF
  -E --QUIT-AT-EOF             Exit on EOF
  -F --quit-if-one-screen      Exit if entire file fits on first screen
  -q --quiet --silent          Silent mode
  -Q --QUIET --SILENT          Completely  silent
  -S --chop-long-lines         Do not fold long lines
  -i --ignore-case             Search ignores lowercase case
  -I --IGNORE-CASE             Search ignores all case
  -x --tabs                    Set tab stops
  -N --LINE-NUMBERS            Display line number for each line
     --no-init                 Disable terminal initialization
     --no-keypad               Disable keypad handling

Your more command seems to be aliased to less. Mine is not, for whatever reason. Strange.

I just checked /opt/openhab2/userdata/etc/shell.init.script and the following alias is defined for help:

help = { *:help $args | more } ;

But since I don’t have a more command in my Karaf shell, I changed this to:

help = { *:help $args | less } ;

This has solved the problem of using the help command. The question is…why don’t I have a more command in my Karaf shell (since the Karaf documentation says that command is implemented by default). I seem to be the only one with this problem…

Did you install openhab via the apt repos or manually?

1 Like

What does your shell.init.script file look like?

Just chiming in that I had the same issue of not having more available. And this fix of editing shell.init.script worked for me. Thanks!

This was in a similar environment. A manual install of 2.3.0-SNAPSHOT Build #1250

Sorry, I should have posted what fixed this for me (of course, once it was fixed, I just moved on…).

I replaced the contents of my shell.init.script with the contents of the same file from the openhab github repo.

They were quite different. My shell.init.script had the default values from the karaf repo and/or documentation. Somehow the OpenHAB upgrade script didn’t touch that file…weird.