Day3 - Basic Linux Command

Day3 - Basic Linux Command

Mastering the Linux Command Line: Essential Commands for Efficient Navigation

ยท

3 min read

Task: What is the Linux command to

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

    Cat(concatenate) command is very frequently used in Linux. It reads data from the file and gives its content as output. It helps us to create, view, and concatenate files.

cat file_name

  1. To change the access permissions of files.

There are three kinds of file permissions in Linux:

Read (r): Allows a user or group to view a file.
Write (w): Permits the user to write or modify a file or directory.
Execute (x): A user or group with execute permissions can execute a file or view a directory.

chmod u+rwx new_file.txt

  1. To check which commands you have run till now.

The history command in Linux is a built-in shell tool that displays a list of commands used in the terminal session. history allows users to reuse any listed command without retyping it.

  1. To remove a directory/ Folder.

To delete a directory with "rmdir", type the command followed by the name of the directory you want to remove. For example, to delete a directory named "directory1" you would type:

rmdir directory1

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

vim fruits.txt

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

  1. Show only the top three fruits from the file.

    Use the Unix head command to read the first few lines of an input file and send them to standard output (that is, your terminal screen). The format for the head command is:

head -3 fruits.txt

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

    Use the Unix tail command to read the last few lines of an input file and send them to standard output (that is, your terminal screen). The format for the tail command is:

tail -3 fruits.text

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

vim colors.txt

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

  1. To find the difference between fruits.txt and Colors.txt files.

Use the "diff" command to compare text files. It can compare single files or the contents of directories.

diff fruits.txt colors.txt

Stay in the loop with my latest insights and articles on cloud โ˜๏ธ and DevOps ๐Ÿš€ by following me on Hashnode, LinkedIn (https://www.linkedin.com/in/chandreshpatle28/), and GitHub (https://github.com/Chandreshpatle28).

Thank you for reading! Your support means the world to me. Let's keep learning, growing, and making a positive impact in the tech world together.

Linux Devops #Devopscommunity #90daysofdevopschallenge

Did you find this article valuable?

Support Chandresh Patle's Blog by becoming a sponsor. Any amount is appreciated!

ย