GithubHelp home page GithubHelp logo

jcmd-bash-completion's Introduction

jcmd-bash-completion

This repository provides a bash completion script for the jcmd utility, which sends diagnostic commands to a running Java Virtual Machine (JVM).

Features

  • Completes JVM process IDs (PIDs) and main class names
  • Dynamically completes available diagnostic commands based on the selected JVM's capabilities

Installation

Ensure that you have bash-completion installed and working in your shell. If not, you can install it using your package manager. For example, on Debian-based systems:

sudo apt-get install bash-completion

Clone the repository:

git clone https://github.com/jiri-pejchal/jcmd-bash-completion.git
cd jcmd-completion

Make the completion script available system-wide by copying it to the bash completion directory. This step requires administrative privileges (the path may vary depending on your operating system):

sudo cp jcmd-completion.bash /etc/bash_completion.d/jcmd-completion.bash

Start a new bash shell or source the completion script:

source /etc/bash_completion.d/jcmd-completion.bash

Usage

Selecting JVM processes

To list the running JVM processes, use:

$ jcmd <TAB>

This will display a list of PIDs and the main class names of the running JVMs, such as:

10345 com.intellij.idea.Main
10537 jdk.compiler/com.sun.tools.javac.launcher.SourceLauncher

PID Completion

Select the JVM by typing the beginning of PID and pressing TAB. For instance:

$ jcmd 103<TAB>

completes to:

$ jcmd 10345

Main Class Name Completion

Select the JVM by typing the beginning of the full name of the class:

$ jcmd com.intellij<TAB>

completes to:

$ jcmd com.intellij.idea.Main

You can also complete using just the last part of the main class name:

$ jcmd M<TAB>

this will complete to:

jcmd Main

Running jcmd Diagnostic Commands

Once a JVM(s) is selected by PID or main class name, the available commands are dynamically completed based on the capabilities of the selected JVM. For example:

$ jcmd 10537 GC<TAB>

this will complete available commands such as:

GC.class_histogram GC.finalizer_info GC.heap_dump GC.heap_info GC.run

Parameter Completion

Parameter completion is available for the command GC.heap_dump.

$ jcmd 10537 GC.heap_dump <TAB>

completes to

-all        -gz=        -overwrite  -parallel=

jcmd-bash-completion's People

Contributors

jiri-pejchal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.