Linux / Unix: logname Command Examples To Display Loginname
The logname command in Unix-like systems is used to display the login name of the user running the command. Here's how to use it:
- Open a terminal or shell window.
- Type the following command:
$ logname - Press
Enter. Thelognamecommand will display the login name of the current user, for example:user
logname command is a simple and easy way to display the login name of the current user, but it may not be available on all Unix-like systems. If it's not available on your system, you can use the whoami or id command to display the current user's information, including the login name.