Skip to content

n2x.io CLI

The n2x.io CLI, n2xctl, is an open-source tool that allows you to manage your n2x.io platform directly from the command line.

How to install

Install the n2x.io command-line interface (CLI) for easier management. Follow the instructions here.

Tab Completion

The n2x.io CLI supports tab-completion for commands, flags, and arguments. You can configure tab-completion with the completion command.

Select your shell, then follow the instructions to load n2x.io CLI completions.

To load tab-completions for Bash, run the following command.

source <(n2xctl completion bash)

Run the following command to load completions for every new session on Linux, then reload your shell.

n2xctl completion bash | sudo tee /etc/bash_completion.d/n2xctl

Run the following command to load completions for every new session on macOS, then reload your shell.

n2xctl completion bash | sudo tee $(brew --prefix)/etc/bash_completion.d/n2xctl

Note

You must have shell completion enabled for your Zsh environment.

echo "autoload -U compinit; compinit" >> ~/.zshrc

Run the following command to load completions for Zsh, then reload your shell.

n2xctl completion zsh | sudo tee "${fpath[1]}/_n2xctl"

Run the following command to load completions for Fish, then reload your shell.

n2xctl completion fish > ~/.config/fish/completions/n2xctl.fish

Run the following command to load completions for PowerShell.

n2xctl completion powershell | Out-String | Invoke-Expression

Run the following command, then source n2xctl.ps1 from your PowerShell profile to load completions for every new session.

n2xctl completion powershell > n2xctl.ps1

Integrated help

Once you've installed the CLI you can access the integrated help:

$ n2xctl help
n2xctl v0.0.3-20240725171430+88c4863--go1.22.5

n2xctl is a CLI to control the n2x SASE platform.

Find support and more information:

  Project Website:     https://n2x.io
  Documentation:       https://n2x.io/docs
  Join us on Discord:  https://n2x.io/discord

Usage:
  n2xctl [command]

Available Commands:
  account     Account administration
  auth        Authentication commands
  alert       Alert system
  tenant      Tenants administration
  network     Networks administration
  subnet      Subnets administration
  node        Network node operations
  vs          Virtual Servers (lb/ha services)
  policy      Security policies administration
  k8s         Connect kubernetes clusters to your n2x network
  ops         Automation and GitOps: projects / workflows / logs
  version     Update client and show version information
  completion  Generate completion script
  help        Help about any command

Flags:
      --config string   configuration file (default: $HOME/.n2x/n2xctl.yml)
  -h, --help            help for n2xctl

Use "n2xctl [command] --help" for more information about a command.

And you can do the same for every available command, so you don't need to know every detail for every command:

$ n2xctl tenant --help
n2xctl v0.0.3-20240725171430+88c4863--go1.22.5

Tenants administration.

Usage:
  n2xctl tenant [command]

Available Commands:
  list        List tenants
  show        Show tenant
  create      Create tenant
  update      Update tenant details
  delete      Remove tenant

Flags:
  -h, --help            help for tenant
  -t, --tenant string   tenant identifier

Global Flags:
      --config string   configuration file (default: $HOME/.n2x/n2xctl.yml)

Use "n2xctl tenant [command] --help" for more information about a command.

Usage

To view a list of available commands and options, simply run:

n2xctl help

For in-depth information about specific commands and their usage, refer to our dedicated CLI Command Reference guide.

Note

  • Login Credentials: When you run n2xctl login, your account's temporary credentials are stored securely by default in the file $HOME/.n2x/apikey.

  • Logout and Credential Removal: Executing n2xctl logout will remove the $HOME/.n2x/apikey file, ensuring your credentials are not stored after the session ends.