brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: tailscale completion adds tab completion for every Tailscale command

Network and access
~/tips/tip-tailscale-completion-zsh

tailscale completion zsh > "${fpath[1]}/_tailscale"

Let your shell complete Tailscale subcommands and flags instead of checking the help.

The Tailscale CLI has a lot of subcommands and even more flags. Opening the help to remember the exact name gets old, and completion fixes that.

For zsh, the help suggests writing the script into the first folder of your function path once:

tailscale completion zsh > "${fpath[1]}/_tailscale"

Open a new shell and tailscale se plus Tab offers serve, service, set and so on. It completes flags too, so tailscale set --ad plus Tab shows the advertise options.

If completion is not active in zsh yet, you need autoload -U compinit; compinit in your ~/.zshrc first.

For bash and fish, the help text has similar one-liners:

source <(tailscale completion bash)
tailscale completion fish | source

Put the bash line in ~/.bashrc to keep it. There is also a PowerShell version.

One small thing: the script is generated by your current client. After a big update, new subcommands will not complete until you regenerate the file, so I’d rerun the command now and then.

Further reading: Tailscale CLI

More Network and access tips scp -3 alice@server-a:/var/backups/db.sql.gz bob@server-b:/srv/restore/ tailscale exit-node suggest tailscale lock sign nodekey:1abddef1 tlpub:abcdef12 wg genpsk > peer1.psk Table = off All Network and access tips (163) All topics

Link