X

Proactive insights, news and tips from Oracle WebLogic Server Support. Learn Oracle from Oracle.

  • August 6, 2009

Command Line Editing in WLST Interactive Mode

Peter Bower
Software Engineer

WLST provides an interactive mode in which you enter a command and view the response at a command-line prompt. Interactive mode is useful for learning the tool, prototyping command syntax, and verifying configuration options before building a script

When entering commands interactively, you want to minimize typing and quickly correct any mistakes. In this blog entry, I summarize the various command line editing options available in WLST in Windows and Unix environments.

Windows environment

When running on a Windows system, WLST uses the Windows command shell for the WLST console. The Windows shell provides a number of keys that can be used to edit and recall commands. There are the common keys:



  • LEFT ARROW and RIGHT ARROW to move within a command

  • HOME and END to move to the start and end of a command

  • UP ARROW and DOWN ARROW to move within the command history




But there are also useful keys that are not as well known



  • F7 shows a dialog box with the command history

  • F8 walks backwards through the command history, but only displays commands that match the text to the left of the cursor

  • CTRL LEFT ARROW and CTRL RIGHT ARROW to move to the next or previous word in a command




The following link provides a good description of all of the keys supported by the Windows shell

http://www.microsoft.com/technet/scriptcenter/topics/winpsh/manual/hotkeys.mspx




Unix environment

In a Unix environment, WLST does not provide any command line editing capabilities. However, you can use a 3rd party tool like JLine to provide line editing in WLST.

JLine provides the following editing capabilities:



  • Command history

  • Line editing

  • Custom key bindings




For more information about JLine refer to http://jline.sourceforge.net/index.html

To use JLIne with WLST, follow these steps.



  1. Download JLine from http://jline.sourceforge.net/downloads.html

    Unzip the file and put the jline jar (current version is jline-0.9.94.jar) into a directory on your machine.

  2. Add the jline jar (current version is jline-0.9.94.jar) to the CLASSPATH

  3. Run JLine as follows

    java jline.ConsoleRunner weblogic.WLST

  4. Alternatively, you can copy the $WL_HOME/common/bin/wlst.sh and then add jline.ConsoleRunner before weblogic.WLST




The default keys in JLine are:



  • UP ARROW and DOWN ARROW to move within the command history

  • CTRL-N and CTRL-P to move within the command history




  • LEFT ARROW and RIGHT ARROW to move within a command

  • CTRL-B moves to the previous character

  • CTRL-G moves to the previous word

  • CTRL-A moves to the beginning of the line




  • CTRL-F moves to the next character

  • CTRL-E moves to the end of the line




  • CTRL-U deletes all characters before the cursor

  • CTRL-W deletes the word before the cursor




See the JLine documentation for information on customizing the key bindings using the keybindings.properties file.

Join the discussion

Comments ( 3 )
  • Trudy Schoultz Thursday, February 3, 2011
    Kudos to you! This is a really good blog here and I love your style of writing. How did you get so good at blogging?
  • amazon shopping Sunday, March 6, 2011
    Between me and my husband we've owned more MP3 players over the years than I can count, including Sansas, iRivers, iPods (classic & touch), the Ibiza Rhapsody, etc. But, the last few years I've settled down to one line of players. Why? Because I was happy to discover how well-designed and fun to use the underappreciated (and widely mocked) Zunes are.
  • how do you copy ps3 games to hard drive Sunday, April 17, 2011
    Hello there! This is my first visit to your blog! We are a team of volunteers and starting a new project in a community in the same niche. Your blog provided us useful information to work on. You have done a extraordinary job!
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha