الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

groups

Show the names of the groups a user is in.

المستوى
لينكس اليومي
المجموعة
المستخدمون والمجموعات
يحتاج root
لا
الحزمة
coreutils

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

groups prints the group names of the current process, or of the users you name. It is the same as id -Gn. The first name is the primary group.

طريقة الكتابة

groups [OPTION]... [USER]...

الخيارات 3

الأكثر استخدامًا

USER
Show the groups of this user (more names allowed).
--help
Show help.
--version
Show the version.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع sudo)

  1. 1My groups

    groups
    student wheel

    The first is the primary group.

  2. 2Groups of other users

    groups lisa omar
    lisa : lisa webadmins
    omar : omar wheel webadmins

    With names, each line starts with the user.

  3. 3After adding a group

    usermod -aG webadmins student
    groups; groups student
    student wheel
    student : student wheel webadmins

    The shell gets the new group only after a new login.

  4. 4Check admin rights quickly

    groups | grep -qw wheel && echo "you can use sudo"

    wheel = sudo on RHEL.

  5. 5Count the groups of a user

    groups lisa | wc -w

    The output includes the name and the colon for a named user.

  6. 6Use it in a script for many users

    for u in anna bob carol; do groups "$u"; done

    Fast check after a lab.

  7. 7Compare with id

    id -Gn lisa

    Same names, no "lisa :" before them.

  8. 8Check a group for a shared folder

    groups | grep -w sales

    Needed to write in a folder owned by group sales.

  9. 9Check the groups of a service user

    groups apache
    apache : apache

    Service accounts should have as few groups as possible.

  10. 10Find members of the docker or wheel group (audit)

    getent group wheel

    groups shows per user; getent group shows per group.

رموز الخروج

0 :: Done. 1 :: A user does not exist.

الدليل الكامل

هذه الصفحة تشرح الأمر بكلمات بسيطة. الدليل الأصلي فيه كل التفاصيل.

في الطرفية: man groups