beginner linux script -g and -c

Posted on 2012-09-13
Last Modified: 2012-09-13
useradd  -g school  -c “John” john

Open in new window

In the code given above,

What I know is it adds group name called "school" and adds a user "john" to school group

not sure what the -c is for

thank you for your help.
Question by:bt1942
    1 Comment
    LVL 68

    Accepted Solution

    -c defines the "comment", which is generally the user's full name, sometimes called "GECOS".

    (Some early Unix systems at Bell Labs used GECOS ["General Electric Comprehensive Operating Supervisor"] machines for print spooling and various other services, so this field was added to carry information on a user's GECOS identity. (Wikipedia))

    This string is stored along with the other info in /etc/passwd.

    -g does not add a group. It defines John as a member of the group "school".

    This group must exist! If it doesn't, use "groupadd" beforehand to create it.

    Use "man useradd" and "man groupadd" for detailed info.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
    You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now