Skip to main content
Update about error message printed to stderr
Source Link
ino
  • 357
  • 3
  • 7

The command id can be used to both to look up UID and/or USER name

  1. look up a UID by USER, for example:
    $ id -u ubuntu
    1000
  1. look up a USER by UID, for example:
    $ id -un 1000
    ubuntu

If the UID or USER is not found on current machine it prints no such user message to stderr, for example:

$ id -un 1234
id: 1234: no such user

From man id:

id - print real and effective user and group IDs
   -n, --name
          print a name instead of a number, for -ugG
   -u, --user
          print only the effective user ID
   -g, --group
          print only the effective group ID
   -G, --groups
          print all group IDs

The command id can be used to both to look up UID and/or USER name

  1. look up a UID by USER, for example:
    $ id -u ubuntu
    1000
  1. look up a USER by UID, for example:
    $ id -un 1000
    ubuntu

If the UID or USER is not found on current machine it prints no such user message, for example:

$ id -un 1234
id: 1234: no such user

From man id:

id - print real and effective user and group IDs
   -n, --name
          print a name instead of a number, for -ugG
   -u, --user
          print only the effective user ID
   -g, --group
          print only the effective group ID
   -G, --groups
          print all group IDs

The command id can be used to both to look up UID and/or USER name

  1. look up a UID by USER, for example:
    $ id -u ubuntu
    1000
  1. look up a USER by UID, for example:
    $ id -un 1000
    ubuntu

If the UID or USER is not found on current machine it prints no such user message to stderr, for example:

$ id -un 1234
id: 1234: no such user

From man id:

id - print real and effective user and group IDs
   -n, --name
          print a name instead of a number, for -ugG
   -u, --user
          print only the effective user ID
   -g, --group
          print only the effective group ID
   -G, --groups
          print all group IDs
Source Link
ino
  • 357
  • 3
  • 7

The command id can be used to both to look up UID and/or USER name

  1. look up a UID by USER, for example:
    $ id -u ubuntu
    1000
  1. look up a USER by UID, for example:
    $ id -un 1000
    ubuntu

If the UID or USER is not found on current machine it prints no such user message, for example:

$ id -un 1234
id: 1234: no such user

From man id:

id - print real and effective user and group IDs
   -n, --name
          print a name instead of a number, for -ugG
   -u, --user
          print only the effective user ID
   -g, --group
          print only the effective group ID
   -G, --groups
          print all group IDs