DAY-2&3  #90DaysofDevOps

DAY-2&3 #90DaysofDevOps

Hello folks. This task is related to basic Linux commands so before jumping into that let me give a short introduction to Linux. After that, there is a task in which I am following #90DaysOfDevops with #TrainWithShubham. Your feedback is appreciated.

LINUX

Introduction of Linux

Linux is a kernel based on the UNIX operating system, not an operating system which many people have a misconception about. Linux is an operating system, just like Windows or macOS, that runs on computers and other devices. It was created by a person named Linus Torvalds.

What makes Linux different is that it is free and open-source, which means that anyone can use it, modify it, and share it with others. This openness has led to a large community of people who work together to improve and develop Linux.

Linux is known for its stability and security. It is used on many different types of devices, from big servers to small smartphones. It can also be customized to suit different needs and preferences.

While Linux can be controlled using commands typed into a special interface called the command line, there are also versions of Linux that have a more familiar graphical interface with icons and windows, similar to other operating systems.

Overall, Linux is a versatile and powerful operating system that offers a free and open alternative to other systems.

Tasks:

Task: What is the linux command to

1. To view what's written in a file.
2. To change the access permissions of files.
3. To check which commands you have run till now.
4. To remove a directory/ Folder.
5. To create a fruits.txt file and to view the content.
6. Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
7. To Show only top three fruits from the file.
8. To Show only bottom three fruits from the file.
9. To create another file Colors.txt and to view the content.
10. Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.
11. To find the difference between fruits.txt and Colors.txt file.

1. To view what's written in a file.

Cat: This is used to concatenate and display files on the terminal. It can also be used to modify existing ones.

cat -b: This adds line numbers to non-blank lines

cat -n: This adds line numbers to all lines

cat -s: This squeezes blank lines into one line

cat –E: This shows $ at the end of the line

2. To change the access permission of files.

chmod: The chmod command is used to change the permissions of files and directories. It allows you to specify who can read, write, and execute a file.

The basic syntax of the chmod command is:

3. To check which command you have run till now.

history: The history command shows you all the commands you have run till now.

4. To remove a directory / folder

rm: The rm command is used to delete files or directories and the contents within them.

rm -r: Deletes the folder or directory recursively.

rm -rf: Force removal of the folder or directory.

Note: Be very careful with this command this will delete everything and there is no undo.

5. To create a fruits.txt file and to view the content.

touch: the touch command is used to create the file.

Cat: then we can use cat command to view it.

6.Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.

Open the vim editor by entering vim devops.txt

then you can run the cat command and print it.

7. To Show only top three fruits from the file.

We will use the awk command and head command to extract a part of a specified information .

8.To Show only bottom three fruits from the file.

We use the tail command and same as above.

9. To create another file Colors.txt and to view the content.

10. Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, and Grey.

11. To find the difference between fruits.txt and Colors.txt file.

We have created fruits.txt by the touch command and we have stored nothing on it whereas Color.txt was created by vim editor where we mentioned all the colors name and then printed it by the cat command.

Some useful Tips when using Terminal👇

• Use the TAB button to autofill what you are typing.

• Use the clear command to clean up the terminal

• Use Ctrl+C to stop an execution

• If you accidentally freeze your terminal by using Ctrl+S, simply undo this with the unfreeze Ctrl+Q.

In the end, Basic Linux commands will help you execute tasks easily and effectively. It might take a while to remember some of the basic commands, but nothing is impossible with lots of practice.

Get Connected:

If you have any suggestion about this post feel free to let me know and be updated on my blog in the following ways:

linkedIn

Twitter

Github

#TrainWithShubham #DevOps #Linux