Reference

upterm-session-current(1)

Show the session this terminal is in

NAME

upterm-session-current - Show the session this terminal is in

SYNOPSIS

upterm session current [flags]

DESCRIPTION

Show the session this terminal is in, from $UPTERM_ADMIN_SOCKET.

upterm host sets $UPTERM_ADMIN_SOCKET for the commands it runs, so a shell in a session can show it, and a prompt can mark it. --admin-socket asks another session's admin socket instead.

Output formats:
-o json JSON
-o go-template='{{.ClientCount}}' a Go template

Template variables: SessionID, ClientCount (this session's terminals and guests), GuestCount, CountsKnown, Host, Command, ForceCommand, Access, ConnectedClients, LaunchID, Open, JoinStateSource, JoinTimeout, JoinDeadline, FirstGuestJoinedAt, Name, Status, Reconnect, TunnelReason, TunnelLostAt, NextAttemptAt, StartConfirmed, ReadOnly, FileTransfer, FileTransferApprovalRequired, LocalForwarding, SSHCommand and JoinCommand. From LaunchID on, a variable the session's upterm doesn't report is empty, false, nil or a zero time (0001-01-01 ...), so test it first: {{with .Name}}{{.}}{{end}}, or {{if not .TunnelLostAt.IsZero}}...{{end}}.

Exits 4 when not in a session ($UPTERM_ADMIN_SOCKET is unset, or no session answers at it), and 1 for any other failure. With -o, not being in a session prints nothing.

OPTIONS

--admin-socket="$UPTERM_ADMIN_SOCKET"
Admin socket of the session to show.

-h, --help[=false]
help for current

--hide-client-ip[=false]
Hide guests' IP addresses from upterm's output. When it isn't set (by flag, environment or config file), they are hidden in CI only; --hide-client-ip=false shows them there too.

-o, --output=""
Output format: json or go-template='...'

OPTIONS INHERITED FROM PARENT COMMANDS

--debug[=false]
Enable debug logging (log file: /build/.upterm/upterm.log). A non-empty DEBUG turns it on too.

EXAMPLE

  # Show the session this terminal is in:
  upterm session current
  # As JSON:
  upterm session current -o json
  # For a shell prompt (prints nothing outside a session):
  upterm session current -o go-template='🆙 {{.ClientCount}} '
  # For a terminal title, with the session's name when its upterm reports it:
  upterm session current -o go-template='upterm{{with .Name}} {{.}}{{end}}: {{.ClientCount}} clients'

SEE ALSO

upterm-session(1)

HISTORY

27-Oct-2026 Auto generated by spf13/cobra