File Exchange

image thumbnail

whoami: a pedestrian user id retriever

version (2.77 KB) by us
whoami displays a full user id and retrieves system properties

1 Download

Updated 23 Jun 2008

View License

WHOAMI displays a long user id (LID) in the form

WHOAMI optionally returns various system properties including a short user id (SID), which only contains static information about the current system
programmers can easily create their own IDs or change the built-in formats, which may be a useful tag in source control

example of the short output (note: formatting will most likely be bad)

>> w=whoami;
>> w
magic: 'WHOAMI'
WHOAMIver: '18-Jun-2008 13:47:52'
MLver: ''
runtime: '18-Jun-2008 14:02:09'
sid: '%us|USZ|ws-nos-36362|x86|Windows XP|'
lid: [1x77 char]
name: 'us'
domain: 'USZ'
host: 'ws-nos-36362'
ip: 'xxx.yyy.141.135'
osarch: 'x86'
osname: 'Windows XP'
osver: '5.1'


>> help whoami

for further explanations of the self-explanatory snippet

Cite As

us (2020). whoami: a pedestrian user id retriever (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

Amit Batifkoff

It has handles leak.


az nephi,
quite correct...
but this is only a small part of WHOAMI's output/capabilities...

Az Nephi

if (isunix)
user = getenv('USER');
user = getenv('username');

Kevin J. Delaney

Works great on my Windows system! Nicely done.

John D'Errico

(Tested the original version.) Does not require a wintel system. I just tested it on my mac - runs fine.

Urs (us) Schwarz

an enhanced version was uploaded several days ago but, unfortunately, has not shown up yet... if you seriously consider using this snippet, please wait until this update is ready (there will be a screenshot)...

w s

Works like a charm! As we are USed to...

Urs (us) Schwarz

dear D Slav
thank you for your catchy comments...
firstly, i did not say requires wintel systems, i simply said: tested on wintel systems - after all it's using java...

then, i'd be very interested to see those two lines you mention... very interested...

did you even look at/run the snippet...

D Slav

Really poor!! and requires "wintel systems". User can get all this info with two lines of code of some extension, and without requirements!

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: getUserName

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!