Day 3 Task: Basic Linux Commands

Day 3 Task: Basic Linux Commands

#devops

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

--> cat <filename>

2. To change the access permissions of files.

--> chmod 777 <filename>

3. To check which commands you have run till now

--> history

  1. To remove a directory/ Folder

-->rmdir <folder name>

-->rm -r <folder name>

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

    -->touch fruits.txt

    -->cat fruits.txt

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

--> vi devops.txt [press i for insert include Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.] save it with wq!

--> cat devops.txt

7. To Show only top three fruits from the file

--> head -n 3 devops.txt

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

    --> tail -n 3 devops.txt

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

-->touch Colors.txt

-->cat Colors.txt

-->diff colors.txt devops.txt

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

    --> echo "red/nPink/nwhite/norange/n > Colors.txt"

    >place standard input into the file

  2. To find the difference between devops.txt and Colors.txt file.

    --> diff devops.txt Colors.txt

uname: It shows the name of the kernel

whoami: Shows current login user

date: shows date and time

mkdir file{1..10}: create 10 files with the given namespace

useradd devops: Create user devops

grep devops/etc/passwd: To check account properties

passwd devops: To create an account password

su: To switch the user

exit: logout user

userdel devops: to delete the user devops

head file: Top 10 lines of the file will be printed

tail file: Bottom lines of the file will be printed [tail -n 3 <filename>]

Thank you for reading this Blog. Hope you learned something new today! If you found this blog helpful, please like, share, and follow me for more blog posts like this in the future.

I would like to connect with you at linkedin.com/in/madhuri-patil-278b19118