Still on Exploring Linux Command(Day 5)
Tags: beginners, cloud, devops, 120days
Published: 2023-06-19 22:02:30

welcome back guys!!! still on Exploring Linux; today i learnt new things which i'm sharing right away. let's ride on 

**Different Group and Group commands**

- cat /etc/passwd: is use to check the added users 

![output of the command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kqw5js9qyw0ky14ztj56.png)
looking at the image well, you will find kmoni and anointed_ken at the bottom. those are the two(2) users available. each carrying different id

- sudo adduser (new username): is use to add a new user

![output of the command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0vqpv1q75l2ltmjlp0va.png)
You are required to set a new password for the added user 

- sudo groupadd (group name): use to create new group

![output of the command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2agerv8gnjgzc9da4igv.png) 

- sudo passwd (user name): use to change a user password

![output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xkopj681uysopjumq916.png)

- cat /etc/group: use to view the groups created

![output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hfinzhxb5u3z21ory75r.png)
you caan see the group "computing" created is just at the last line of the output of the command

- sudo usermod -g (groupname)(username): use to add a user to a group and u can confirm using "groups (username).

![output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/codtlxv5pcnybfa3a1pg.png)

**Users and Permission**

- ls -l: prints files in a long listing format

![output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p941swhsljlne9bhunw3.png)
The details shows permission on the folders and files.
let's look into the output of the command and get to know what each details means. i will use the first line to explain the details
 "drwxrwxr-x 1 kmoni   kmoni   512 Jun 16 08:16 Example"
you will notice the name "kmoni" appears twice. the first "kmoni" stands for the user name while the second "kmoni" stands for the group name.
"d" stands for directory i.e we are dealing with a directory here and "Example" is a directory
"rwx" the first 3 letters after "d" is the permission given to the user "kmoni". the next "rwx" is the permission given to the group "kmoni". while the last "r-x" is the permission given to "others"
"r" stands for read
"w" stands for write
"x" stands foe execute
with this i believe we can decode the rest details from the output of the command we did ealier

- sudo chown (new username):(new group name)(file name): use to change ownership completely
from the details we had earlier, let change the ownership of the file name "greting.txt" line 13

![output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/coa8jduunijuic76rtfd.png)
Did you notice the changes??

- sudo chown (new username)(file name): use to change the user ownership

![output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gkjjgqlmxzxmf147o8jh.png)

- sudo chgrp (group name)(filename): use to change the group owner

- sudo chmod -permission filename: use to remove a particular permission from a file. let remove the read(r) permission from data.csv 

![output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xi5wqk962kj39p0i3s9l.png)

- sudo chmod g- (permission)(filename): use to remove a permission from the group user. let's remove the read(r) from the group user of document.pdf

![output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9uk3gfst6q9gv0zupvnf.png)

- sudo chmod u-(permission)(filename): use to remove a permission from the user. 

- sudo chmod g+(permission)(filename): use to add permission to a group user.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lnx738rti49mjwxufmbk.png)

That is it for today. DAY 6 LOADING. THANKS GUYS!!!