Karaf console commands Cheat Sheet

This page serves as a cheat sheet with frequently used Karaf console commands, i.e. the descriptions are intentionally kept compact. Commands of particular interest are in bold. Detailed documentation under Apache Karaf Container 4.x - Documentation or Karaf console commands for the BPC.

General

Command Description

logout

Terminates the current Karaf console session

shutdown -r

Terminates and restarts Karaf (not OpenSearch)

<TAB-Taste>
<command/subshell/…​><TAB-Taste>
<Subshell>:<TAB-Taste>

The tab key lists possible commands, subshells etc., or for a subshell its commands (e.g. bpc:<TAB-Taste>), or for a command the options. The name does not have to be typed in completely and is automatically completed if it is unique - for example, the input fe<TAB>:ins<TAB> becomes the command feature:install

<command/subshell> --help

Help for the command.
Depending on the configuration, the aliases help <befehl/subshell> and man <befehl/subshell>

<Subshell-Name> also work:<Befehl><Enter>

Executes the command of the specified subshell.

<Subshell-Name><Enter><Befehl><Enter>

Switches to the specified subshell (from the parent shell or any subshell) and executes the command.

exit

Exits the subshell and returns to the parent shell.

List, install, stop Karaf bundles, etc.

Command Description

list

Show installed bundles and their status

list | grep -i -v "active"

Show installed bundles whose line does not contain "active" (-v), ignore upper/lower case (-i)

stop <ID>

Stop the bundle with the specified ID (can be determined via list)

restart< ID> [, <ID> ]

Restart the bundle with the specified ID (can be determined via list)

feature:install <featurename>

Installs a feature, e.g. feature:install pax-jdbc-postgresql
Partial alternative to deployment in the sense of copying files to <karaf-install-dir>/deploy

bundle:install -s <URL>

Installs and starts an OSGi bundle, typically with URL pattern mvn:my/bundle/1.0

bundle:uninstall <URL>

Uninstalls an OSGi bundle

Information about the system

Command Description

log:display -n 50

Shows the last 50 log entries

log:tail [-n 20]

Shows the last [20] log entries and then the new entries as they are added.
Exit with CTRL-C.

log:tail | grep "search term"

Shows newly added log entries that contain the search term.

info

Shows important system information, e.g. in which path it is installed. Useful if you use SSH access and therefore do not know where the instance you have connected to is installed.

system:property <key>

Shows the value of system properties. Examples of key are java.home (directory of the JVM used) or java.runtime.version or karaf.log(directory with log files)

system:version

Version of Karaf

dev:dump-create

Creates a ZIP file with comprehensive information for problem analysis, which is required for support requests, for example.

Manage Karaf users

These are not necessarily identical to the end users who log in to BPC via browser, e.g. with INUBIT as identity provider.

Command Description

jaas:realm-list

Listing of the realms to find out the correct realm - often realm 3 is the one for org.apache.karaf.jaas.modules.properties.PropertiesLoginModule

jaas:realm-manage --index 3

Switch to the realm you want to work with

jaas:user-list

Check the users and Karaf roles in the realm

jaas:user-add testUser myPass

Create the user testUser with password myPass

jaas:role-add testUser admin

Give the user testUser the role admin

jaas:update

Save changes

BPC commands


Keywords: