Linux Basic Commands for DevOps (PART-2)

Share via:
Dear Readers,

In this article we will see Linux basic commands for DevOps(Part-2)

Please check below article for part-1

Basic Linux Commands for DevOps (PART-1)

Users and Groups

Add a new user

To see the list of users

To see recently created users

To see recently created user

Groups

when you create any user on that name one group will be created by default.
User will be there in same group by default.

Primary Group
The groups will be created default.

Secondary Group
The group will be created by users.(Manually)

Add a new group 

To see list of groups

To see recently created groups

To see recently created group

Add user “Ramesh” to Group “DevOps”

Verify group

Add Multiple users to Group “DevOps”

Create multiple users

Add Multiple users to Group “DevOps”

Verify groups

Removing user “Hanuma” From Group “DevOps”

Verify groups

Remove User

Verify user

Soft Link

Create a new file

Create a soft link 

To see the content of soft link file

Add Content to the soft link file

To see the content of soft link file

To see the content of Mianfile

Remove Main file “file”

To see the content of soft link file

Note
If you remove main file,we can’t open soft link file.
It’s act like a shortcut.

Remove all files and directories 

Hard Link

Create a new file

Create a hard link

To see the content of hard link file

Add content to hard link file

To see the content of hard link file and Main file

Add content to Main file

To see the content of hard link file

Remove a Main file

To see the content of hard link file

Remove all files and directories

Note
If you delete Mainfile,even we can open hardlink file.
It’s like a complete backup copy.
Both will be in sync always.

Tar
To pack the files and directories.

Zip
Zip is a file
If you apply zip on top of folder that became a file(Zip file).
It will be used to compress the size.

Create a directory “documents”

Create file “photos” inside the directory “documents”

Create tar file

Remove Directory “documents”

Create a Zip file

To Remove Zip 

To Remove tar

Go inside documents directory and verify files

Download Package from website

wget
Using wget Command

Verify Package

Remove All files and directories

File/Directory Permissions
Permissions are applied on three levels

Owner
Group level
Others level

Access modes are of three types

r – read only
w – write/edit/delete/append
x – execute/run a command

Create a file and Directory
Create file using touch and create directory using mkdir Command.

By Default,there is some hidden files inside the directory.
when you create any directory,by default two hard links will be created.
when you create any file,by default one hard links will be created.
Read – 4
Write – 2
Execute – 1
By default directory having 755 permissions
Owner -7 (rwx)
Group -5 (rx)
Others -5 (rx)
By default File having 644 permissions
Owner -6 (rw)
Group -4 (r)
Others -4 (r)

To Give Full Permissions to file (777)

Revoke Full Permissions except owner from file (700)

Revoke all permissions from file (000)

To give default permissions for file and Directory

To Give Full Permissions for Directory (777)

Give Read Write permissions for all (666)

Change the owner of file

To see list of updated users

Change owner of file “file”

Change group of file “file1”

Note
Members inside DevOps group will get read and write permissions.

find
To find all files in current directory

To find all directories in current directory

To find all file under top level root directory

To find all directories under top level root directory

To search “passwd” file under top level root directory

To search “group” file under top level root directory

To search “os-release” file under top level root directory

To search directory “dir1” under top level root directory

To search directory “dir1” in current directory

To find all files in current directory

To see name of your machine

To get IP Address

To see OS-Version

To Install Package

yum install

To Upgrade Package

To Uninstall Package

To see Installed Packages

To see the status of httpd service

To start httpd service

To see the status of httpd service

To Restart httpd service

To Start service permanently

To Stop service permanently

To Verify the package installed or not

To see the current user

Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates

 

KTEXPERTS is always active on below social media platforms.

Facebook : https://www.facebook.com/ktexperts/
LinkedIn    : https://www.linkedin.com/company/ktexperts/
Twitter       : https://twitter.com/ktexpertsadmin
YouTube    : https://www.youtube.com/c/ktexperts
Instagram   : https://www.instagram.com/knowledgesharingplatform

Follow Me
Ramesh’s Linkedin : Ramesh Atchala

Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 4.33 out of 5)
Loading...

5 thoughts on “Linux Basic Commands for DevOps (PART-2)

Add Comment