Karaf Console Commands Cheat Sheet

This page serves as a cheat sheet for frequently used Karaf console commands; that is, the descriptions are intentionally kept concise. Commands of particular interest are in bold. Detailed documentation is available at Apache Karaf Container 4.x - Documentation or Karaf Console Commands for the BPC.

General

Command ** Description

logout

Ends the current Karaf console session

shutdown -r

Shuts down and restarts Karaf (not OpenSearch)

<TAB-Taste>
<Command/Subshell/…​><TAB-Taste>
<Subshell>:<TAB-Taste>

Pressing the Tab key lists possible commands, subshells, etc., or—for a subshell—its commands (e.g., BPC:<TAB-Taste>), or—for a command—its options. You do not need to type the entire name; if it is unique, it will be automatically completed—for example, entering “ fe<TAB>:ins<TAB> ” will result in the command “ feature:install

<command/subshell> --help

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

<Subshell-Name> may 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, etc., Karaf bundles

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 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., the PostgreSQL JDBC driver with feature:install pax-jdbc-postgresql
Partial alternative to deployment in the sense of copying files to <BPC-INSTALL-DIR>/karaf/deploy

bundle:install -s <URL>

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

bundle:uninstall <URL>

Uninstalls an OSGi bundle

System Information

Command Description

log:display -n 50

Display the last 50 log entries

log:tail [-n 20]

Displays the last [20] log entries and then continuously displays new entries as they arrive.
Press CTRL-C to exit.

log:tail | grep "search_term"

Displays new log entries as they arrive that contain the search term.

info

Displays important system information, such as the installation path. This is useful if you’re using SSH access and therefore don’t know where the instance you’re connected to is installed.

system:property <key>

Displays the values of system properties. Examples of ` key ` include ` java.home ` (directory of the JVM in use), ` java.runtime.version , or ` `karaf.log` (directory containing log files) `

` system:version

Karaf version `

` dev:dump-create

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

` == Manage Karaf Users

These are not necessarily the same as the end users who log in to BPC via a browser, for example, when using INUBIT as an identity provider.

Command Description

jaas:realm-list

List of realms to help identify the correct one—Realm 3 is often 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 the password myPass

jaas:role-add testUser admin

Assign the role admin to the user testUser

jaas:update

Save changes

BPC Commands


Keywords: