DEV Community

Cover image for Still on Exploring Linux Command(Day 5)
Kenneth Mahon
Kenneth Mahon

Posted on

Still on Exploring Linux Command(Day 5)

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
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
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

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

output

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

output
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

Users and Permission

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

output
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
Did you notice the changes??

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

output

  • 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

  • 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

  • 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

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

Top comments (0)