Useful Linux Commands - Part 4

The following are a list of commonly used Linux Administration Commands.

User and Group Commands

Linux Command Description
useradd -m -c "Users name" userid Create a new user with a default home are of /home/userid
usermod -g new_primary_group userid Change primary group of a user
usermod -G group1,group2 userid Change group membership of a user. Separate groups with a comma.
usermod -d new_directory_path userid Change a users home area
usermod -s Specify shell userid Change the users shell to the specified shell. Must be full path: /bin/bash
userdel -r userid Remove userid and home directory of specified user from system
userdel userid Remove userid from system. Does not remove users home area
groupadd group Create New group
groupdel group Remove specified group
groupmod options group Modify a group
passwd -S userid Display status of userid specified
passwd userid change or set password for specified user. If no userid is passed, assumes current user
passwd -l userid Locks specified userid
passwd -u userid Unlocks specified userid
id userid Display user and group information
groups userid Display group membership for specified userid