upterm session current
Show the session this terminal is in
Synopsis
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=’’ 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: , or ….
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.
upterm session current [flags]
Examples
# 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='🆙 '
# For a terminal title, with the session's name when its upterm reports it:
upterm session current -o go-template='upterm : clients'
Options
--admin-socket string Admin socket of the session to show. (default "$UPTERM_ADMIN_SOCKET")
-h, --help help for current
--hide-client-ip 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 string Output format: json or go-template='...'
Options inherited from parent commands
--debug Enable debug logging (log file: /home/user/.local/state/upterm/upterm.log). A non-empty DEBUG turns it on too.
SEE ALSO
- upterm session - Display and manage terminal sessions