function::uid - Linux


function::uid converts a user-readable string representation of a user’s ID to a user ID and provides any corresponding group information. It performs the inverse function of id.


function::uid [USERNAME | UID]




To retrieve the user ID and group information for the user "alice":

$ function::uid alice

To retrieve the user ID for the user with the user ID 1000:

$ function::uid 1000

Common Issues

No Matching User

If the provided user name or ID does not match any existing user, function::uid will return an error message. Make sure to specify a valid user name or ID.

Permission Denied

If the user running the command does not have permission to access the system’s user database, function::uid will return a permission denied error. Check the user’s permissions and ensure they have the necessary privileges.


function::uid can be used in conjunction with other commands and tools for various tasks:

  • Combine with grep to find users matching specific criteria:
function::uid | grep 1000
  • Use within scripts to automate user management tasks:
if function::uid $USERNAME > /dev/null; then
  echo "User $USERNAME exists."
  echo "User $USERNAME does not exist."

Related Commands

  • id: Displays information about the current user’s identity.
  • getent / getpwent: Reads information from the system’s user database.
  • useradd: Adds a new user to the system.
  • userdel: Deletes a user from the system.