Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Account Management in Linux

** Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement! **

Create a User

Both adduser and useradd can be used to create a new user. adduser is interactive while useradd is non-interactive. It is suggested that you use useradd in batch …

Get Group Names on Linux/Unix

Linux

  1. Get information of the staff group.

    $ getent group staff
    staff:x:20:
    
  2. Get group ID of the staff group.

    $ getent group staff | cut -d: -f3
    20
    

Mac

  1. Get information of the staff group.

    $ dscl . -read /Groups/staff
    
  2. Get group ID of the staff group.

    $ dscl . -read /Groups/staff | awk …