Welcome to the tmsh api section! tmsh is an exciting new way to create commands and automate tasks via the CLI on your BIG-IP. By making use of TCL scripting you can automate existing commands, create your own custom commands, and fully automate processes that you may wish to repeat. Rather than entering 16 commands to create those 16 pool members, why not use a script that takes arguments and allows you to enter one command to create as many or as few members as you want all at once? We’ll be adding many new examples to the CodeShare as well as more docs showing you how to get started with tmsh scripting in your own environment, so be sure to check back often.


For the full traffic management shell reference, see F5 TMSH Reference

Reference Topics

Here’s a list of some reference information that you can use to help you with all of your tmsh needs. Note that these are available from most Wiki pages in the navigation pane to the right of the screen.
  • Commands - Documentation for tmsh Commands.

Importing Code to TMSH

To import code you can use a cut and paste to import into the tmsh script editor. Here’s the process (These instructions assume general familiarity with the vi editor):
1) Enter tmsh shell if you are not already in it from the F5 Advanced Shell. From your terminal program, type tmsh then press enter. You will see:

2) Enter the CLI Script mode, type cli script then press enter. You will see:

3) Create your new application and enter the editor, type edit where filename is the name of the program you are creating or importing. For example: edit importPoolMembers.tcl
4) Cut & paste code. When pasting code, auto-formatting functions of the editor (vi) must be turned off. To disable formatting in vi, type “:set paste” then press enter (“:set nopaste” to re-enable). You should not see any output if the command was parsed correctly; to confirm which mode the editor is in, type “:set paste?” and the mode will be displayed at the bottom of the term.
5) Now, delete all pre-filled in parts of the new file by using standard vi commands (for example dd) then go into edit mode and cut and paste the code from CodeShare.

The BIG-IP API Reference documentation contains community-contributed content. F5 does not monitor or control community code contributions. We make no guarantees or warranties regarding the available code, and it may contain errors, defects, bugs, inaccuracies, or security vulnerabilities. Your access to and use of any code available in the BIG-IP API reference guides is solely at your own risk.