How to create or delete user in Linux

  • To create a new user named joe:
$ sudo useradd joe

The above command does not create a home directory for the new user.

  • To create a new user named joe and create a home directory for him:
$ sudo useradd -m joe
  • To delete a user named joe:
$ sudo userdel joe

The above command does not remove the files owned by the user.

  • To delete a user named joe and remove all the files owned by him:
$ sudo userdel -r joe

Tried with: Ubuntu 16.04

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.