Your Question: How Do I Print a User Id in Linux?
Contents How Do I Print a Username in Linux? to Get the Current User Name, Type: Echo “$User” U=”$User” Echo “User Name $U” Id -U -N. Id -U. #! /Bin/Bash...
Contents
How do I print a username in Linux?
To get the current user name, type:
- echo “$USER”
- u=”$USER” echo “User name $u”
- id -u -n.
- id -u.
- #!/bin/bash _user=”$(id -u -n)” _uid=”$(id -u)” echo “User name : $_user” echo “User name ID (UID) : $_uid”
8 мар. 2021 г.
Must Read
How do I find my user ID in Linux?
4 Answers
- Using the id command you can get the real and effective user and group IDs. id -u <username> If no username is supplied to id , it will default to the current user.
- Using the enviroment variable. echo $UID.