Dos Command for Current logged in Username
This article gives the the CLI (command line interface) function for finding current logged in username in different operating systems.
To our surprise, it is the same command in all these OS – Windows DOS, Linux & Mac OS.
Follow these steps in Windows PC.
- Press Windows Key + R.
- Type ‘cmd’.
- Press Enter.
In the dos prompt, try this command.
whoami
This command displays the current username.
Similarly you can try this in a Unix or Mac OS environment as well.
Similar to this command, it would be fascinating, if all the different OS developers/founders have designed common functionalities with same name across all platforms.
How easy it would be for the programmers?
Note:
- MacOS recently changed the functionality to ‘id – un’.
- In DOS, you can also use to retreive it from environment variable like ‘echo %username%’