Here are common linux command examplers for managing user accounts.
Displaying user details
Syntax: id {username}
shell> id tildemark
Create a new user with username tildemark
Syntax: useradd {username}
shell> useradd tildemark
Create a new user with username tildemark under group admin
Syntax: useradd -g {group} {username}
shell> useradd -g admin tildemark
Creating a new user with username tildemark and assign a home folder
Syntax: useradd -d {location} {user}
shell> useradd -d /home/tildemark tildemark
Creating a new user tildemark and assigning a password pass
Syntax: useradd -p {password} {username}
shell> useradd -p pass tildemark
assigning password to user tildemark
Syntax: passwd {username}
shell> passwd tildemark
Creating a new group
Syntax: groupadd {group}
shell> groupadd developers
Creating a new user and assigning it multiple groups admin, developers
Syntax: useradd -G {group1}, {group2} {,...}
shell> useradd -G admin, developers
Assigning user tildemark to group admin, developers
Syntax: usermod -G admin, developers tildemark
Delete an existing user
Syntax: userdel {username}
shell> userdel tildemark
Leave a comment