user and group management in linux command line terminal | Pro Tech guides

user and group management in linux command line terminal

Every Linux user must know how to manage your user and groups. You can assign user to the group. create a new group.

user and group management in linux terminal | flags and examples

group management in linux
user and group management in linux

Hello, guys welcome to the next session on Linux command line tutorial. Today You will learn about the "basics of group management" using Linux terminal.

I'm going to show you a bunch of commands,

Display groups, you are currently connected

Group command in group management
show your connected groups

$groups
First I'm going to show you a command called "groups".

This command allows you to see which are the groups your current "user" is connected to.

List all groups in your Linux system

Group management in linux to list all groups
List all groups

$cat /etc/group
The next command I'm going to show you is to list all the groups which are available on your "operating system".

  • There is a directory called "etc" and in this etc directory there is a file called "group" and all the groups are listed there.

So I'm going to write "cat /etc/group" and then press ENTER

And it's going to show you all the "groups" which are there on your system.

Create a new group

user and group management in linux to create a new group
Create a new group

$sudo groupadd groupName
The next command is to add the "new group" to this list of groups.

So these groups are added to this file in date wise order.

Whatever groups you will add. It will be added to the bottom of this file.

Let's add a group. I'm going to write "sudo groupadd group_1" and press ENTER

And I am going to give my password. So this "group_1" will be added to the file in the "etc/group"

So just "cat" this once again and you can see this group is added to your group list.

Delete a group

user and group management in linux command line terminal
Delete a group in linux

$sudo groupdel groupName
Next command is to "delete the groups".

For example, I want to delete the group called "group_1" then I can just write "sudo groupdel group_1" press ENTER

Add a user to the group

user and group management in linux to assign a user to the group
Assign a user to the group

$sudo gpasswd -a [userName] [groupName]
The next command I'm going to show you. How you can assign a user to a particular group?

For example, I want to assign the user (ansal) to the group (group_1)

So for this, you will write "sudo gpasswd -a ansal group_1". and press ENTER

  • "-a" flag for adding the user to the group.

And then you can see this message "Adding user ansal to group group_1".

Remove a user from the group

user and group management in linux to delete a user from the group
Delete a user from the group

$sudo gpasswd -d [userName] [groupName]
If you want to "remove a user" you can just write "sudo gpasswd -d ansal group_1" and press ENTER

  • Instead of "-a" flag you can use the flag "-dfor removing the user from the "group".

And you can see this message "Removing user ansal from group group_1".

Conclusion

So in this way, you can use "group management".

And these are some of the commands which you can use for group management in your Linux operating system using the terminal.

I hope you enjoyed this tutorial please rate comment and bye for now.

HAVE A NICE DAY💞

Name

Apps,3,Games,1,Linux,38,Linux Commands,37,Network-Devices,1,Networking,1,Terminal Apps,2,Termux,17,Userland,3,Windows,1,
ltr
item
Pro Tech guides: user and group management in linux command line terminal
user and group management in linux command line terminal
Every Linux user must know how to manage your user and groups. You can assign user to the group. create a new group.
https://1.bp.blogspot.com/-20HJ9UZ36HE/X_2Rg3C6tYI/AAAAAAAAC88/QA4GmNCxHIMBOxpP1eA43h11Ps5XQ4RPACNcBGAsYHQ/s16000/user-and-group-management.jpg
https://1.bp.blogspot.com/-20HJ9UZ36HE/X_2Rg3C6tYI/AAAAAAAAC88/QA4GmNCxHIMBOxpP1eA43h11Ps5XQ4RPACNcBGAsYHQ/s72-c/user-and-group-management.jpg
Pro Tech guides
http://www.protechguidez.com/2021/01/user-and-group-management-in-linux.html
http://www.protechguidez.com/
http://www.protechguidez.com/
http://www.protechguidez.com/2021/01/user-and-group-management-in-linux.html
true
7053638852026728047
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content