Linux: User Account Infomation Cheat Sheet

# Display the user and group ids of your current user

id

# Display the last users who have logged onto the system

last

# To show all the users who were present at a specified time

last -ap now

# Find the details of a recent login of all users or of a given user as follows

lastlog

# Show who is logged into the system

who

# Show who is logged in and what they are doing

w

# Create a group named “groupname”

groupadd groupname

# Create an account named kim, with a comment of “Kim Kardashian” and create the user’s home directory

useradd -c "Kim Kardashian" -m kim

# Add the kim account to the sales group

usermod -aG sales kim

# Delete the kim account

userdel john

Leave a Reply

Your email address will not be published. Required fields are marked *