← Back to notes
Rust Ecosystem 2026-10-07 02:57 1 min read Local copy

whoami in rust

whoami in rust
csm
csm

Posted on Oct 7

whoami in rust
#rust #linux #opensource #showdev
whoami

A reimplementation of the Linux command whoami in Rust.

link to repo

Overview

whoami displays the user name associated with the current effective user ID. Same as id -un.

Example:

whoami
csm

Development Environment

  • Operating System: Linux Mint
  • Rust Toolchain

Building the Project

  • clone the repo
  • cd into the cloned repo
  • to build:
cargo build --release
  • to build and run:
cargo run -- -help

Commands

whoami <no args>     -> Print effective userid
whoami -version, -v  -> Print whoami version
whoami -help,    -h  -> Print whoami commands

License

MIT


What I learned?

  • Simple command does not mean simple to implement
  • For the first time wrote some unsafe rust code with libc crate.

Top comments (0)

Subscribe

For further actions, you may consider blocking this person and/or reporting abuse