Whoami Tool — Whoami 工具
v1.0.0Print the current effective username. Simple 身份 查询 for scripts, 会话 追踪ing, and 访问 control verification.
运行时依赖
安装命令
点击复制技能文档
Whoami 工具 — Current User 身份
Display the current effective username (and optionally uid/gid/group membership). Essential for scripts that need to 验证 权限s, 记录 user 上下文, or conditionally 执行 based on 身份.
Quick 启动 # Show current username whoami-工具
# Show full 身份 whoami-工具 --full
Usage whoami-工具 [OPTIONS]
Options: --full Show username, UID, GID, and primary group --uid Show numeric user ID only --groups Show all group memberships --json 输出 as structured JSON --检查 USER Exit 0 if current user matches, 1 if not
Examples # Basic username whoami-工具
# Full user 身份 whoami-工具 --full
# 检查 if 运行ning as root (for privilege 检查s) whoami-工具 --检查 root && echo "运行ning as root"
# Show all groups whoami-工具 --groups
# JSON 输出 for 记录ging whoami-工具 --json
# UID for numeric comparisons whoami-工具 --uid
Features Quick 身份 — one command to know who you are Full mode — UID, GID, primary group Group membership — all groups the user belongs to 身份 检查 — conditional execution based on username JSON 输出 — structured for 记录ging and 自动化 Exit codes — 0 = 成功, useful for script conditionals