Cheatsheets
HomeWriteupsResourcesCheatsheets
Linux
Linux
  • Know Yourself and Your System
    • id
    • logname
    • uname
    • w
    • who
    • whoami
  • Surfing / Knowing Your File System
    • cd
    • df
    • du
    • ls
    • pwd
    • stat
    • tree
  • Knowing About Files / Commands
    • alias
    • file
    • info
    • whatis
    • apropos
    • man
    • help
    • history
    • script
  • Manipulating Files / Directories
    • touch
    • mkdir
    • rm
    • rmdir
    • cp
    • mv
    • ln
  • Interacting with Files
    • cat
    • head
    • less
    • middle
    • more
    • tail
  • STROPS / Text Manipulation
    • awk
    • cut
    • grep
    • jq
    • join
    • paste
    • sed
    • sort
    • tr
    • uniq
    • xargs
    • xclip
    • wc
    • tee
    • echo
    • comm
    • diff
    • patch
    • aspell
    • Combos
  • Formatting the Output
    • nl
    • fold
    • fmt
    • pr
    • printf
  • Searching / Finding
    • find
    • locate
    • which
    • whereis
    • type
  • Web Interaction
    • curl
    • wget
  • xxd
  • References
Powered by GitBook
On this page
  • Introduction
  • Syntax
  • Important Flags
  • Examples

Was this helpful?

  1. Know Yourself and Your System

id

id linux command cheatsheet by Thamizhiniyan C S

Introduction

The id command is used to print real and effective user and group IDs


Syntax

id [OPTION]... [USER]...


Important Flags

Flag
Description

-g

Print only the effective group id.

-G

Print all Group ID’s.

-n

Prints name instead of number.

-r

Prints real ID instead of numbers.

-u

Prints only the effective user ID.

–help

Display help messages and exit.

–version

Display the version information and exit.


Examples

Command
Description

Print the current user's UID and GID.

Find the UID of the user named "root".

Find the GID of the user named "root".

Find the UID and all groups associated with the user "root".

Display the UID and all groups a user "root" belongs to.

Display the name instead of numbers for GID of "root".

Display the name instead of numbers for UID of "root".

Display the name instead of numbers for all groups of "root".

Display the real GID instead of effective GID of "root".

Display the real UID instead of effective UID of "root".

Display the real group IDs instead of effective groups of "root".

Nextlogname

Last updated 12 months ago

Was this helpful?

id
id -u root
id -g root
id root
id -G root
id -ng root
id -nu root
id -nG root
id -r -g root
id -r -u root
id -r -G root