DEV Community

Arunima Das
Arunima Das

Posted on

Day2 &3 -#90DaysofDevops Introduction to DevOps

Q: What is Linux?

Linux is a family of free and open-source operating systems based on the Linux kernel. Operating systems based on Linux are known as Linux distributions, or distros. Examples include Debian, Ubuntu, Fedora, CentOS, Gentoo, Arch Linux, and many others.

The Linux operating system's architecture mainly contains the following components: the kernel, system library, hardware layer, system, and shell utility.

Basic Linux Commands:

ls - > List all directories/files

ls -a -> List all files along with hidden files

ls -R -> shows all files in a subdirectory

cd ->for changing the directory

cat -> It can be used to create a file, display the content of the file, copy the content of one file to another file, and more.

touch-> for creating empty files

mkdir -> to make a new directory

cp -> To copy files

mv -> to move files around

rm -> to remove files

Directory commands

pwd--> print work directory. Gives the present working directory.

cd path_to_directory--> Change the directory to the provided path

cd--> change directory to the home directory

cd - --> Go to the last working directory.

cd .. --> change directory to one step back.

cd ../.. --> Change directory to 2 levels back.

mkdir directoryName --> to make a directory in a specific location

Tasks:

To view what is written in file

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ echo "Learning devops.." >task.txt

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ cat task.txt
Learning devops..
Enter fullscreen mode Exit fullscreen mode

To change the access permissions of files.

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ ls -l  task.txt
-rw-r--r-- 1 Arunima 197121 18 Apr 10 16:21 task.txt

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ chmod 765 task.txt

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ ls -l  task.txt
-rw-r--r-- 1 Arunima 197121 18 Apr 10 16:21 task.txt
Enter fullscreen mode Exit fullscreen mode

3)To check which commands you have run till now.

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ history
.. 
167  mkdir day3
  168  cd day3
  169  echo "Learning devops.." >task.txt
  170  cat task.txt
  171  ls -l  task.txt
  172*
  173  ls -l  task.txt
  174  chmod 765 task.txt
  175  ls -l  task.txt
  176  chmod 777 task.txt
  177  history
Enter fullscreen mode Exit fullscreen mode

4)To remove a directory/ Folder.

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ mkdir random

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ ls
random/  task.txt

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$  rm -rf random/

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ ls
task.txt
Enter fullscreen mode Exit fullscreen mode

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

Here we used vim to create a file . Then we enter shift+i and entered contents then ecp and :wq to return

to view content we used cat command

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ vim fruits.txt


Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ cat fruits.txt
apple
mango
cherry
banana

Enter fullscreen mode Exit fullscreen mode

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

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ vim devops.txt
Enter fullscreen mode Exit fullscreen mode

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

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ head -3 devops.txt
Apple,
Mango,
Banana,
Enter fullscreen mode Exit fullscreen mode

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

$  Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ tail -n 3 devops.txt
Enter fullscreen mode Exit fullscreen mode

9)Create a file colour .txt add content and view it

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ vim colour.txt

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ cat colour.txt
Red
pink
white
black
blue
orange
purple
grey
Enter fullscreen mode Exit fullscreen mode

10)To find the difference between fruits.txt and Colors.txt file.

Arunima@DESKTOP-JETUU7R MINGW64 /e/devops-handson/90days/day3 (master)
$ diff colour.txt fruits.txt
1,8c1,4
< Red
< pink
< white
< black
< blue
< orange
< purple
< grey
---
> apple
> mango
> cherry
> banana
Enter fullscreen mode Exit fullscreen mode

Do share your thoughts. I'll work on it and try to get better. Thank you.
~ Arunima

Top comments (1)

Collapse
 
slowjerm profile image
Enoch Baah

Nice ❤️