Day3: Linux Command-Line Essentials for Beginners

Day3: Linux Command-Line Essentials for Beginners


3 min read

Play this article


Linux commands refer to the set of instructions and actions that can be executed via a command-line interface (CLI) in a Linux-based operating system. These commands are used to perform various tasks, manage the system, manipulate files and directories, and interact with the computer's hardware and software. Linux commands are an essential part of working with Linux systems and are often used by system administrators, developers, and power users.

Why it is important to learn:

Learning Linux commands is important for several reasons, especially if you are working in the field of information technology or software development. Maximum number of development done in Linux. Here are some compelling reasons why learning Linux commands is valuable:

  1. Versatility: Linux commands are versatile and can be used for a wide range of tasks, from system administration to automation to troubleshooting.

  2. Career Opportunities: Proficiency in Linux commands is often a prerequisite for job roles in IT, DevOps, system administration, and cybersecurity.

  3. Server Administration: Linux is the dominant choice for server operating systems, making Linux command knowledge crucial for managing servers and cloud infrastructure.

  4. Automation: Linux commands enable you to automate repetitive tasks and workflows, improving efficiency and reducing errors.

  5. Development Environment: Linux provides a robust environment for software development, and understanding Linux commands can enhance your development workflow and productivity.

What is the Linux command to:

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

    • cat is this command to show what's written in a file.

  1. To change the access permissions of files:

    • chmod is the command to change the permissions of files.

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

    • history is the command to check the commands you recently run.

  1. To remove a directory/ Folder:

    • rm -r is the command to remove a directory or a folder.

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

    • First, create the fruits.txt file with the command nano and edit the file.

    • After editing the file, use cat command to display the content of the file.

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

    • Use the nano command to create a devops.txt file and write the content in sequence (one in each line).

    • Then use cat command to display the content.

  3. To Show only the top three fruits from the file:

    • Use head -n command to show the top three fruits. head command specifies the top and -n specifies the number you want to show.

  4. To Show only the bottom three fruits from the file:

    • Use tail -n command to show the bottom three fruits. tail specifies the bottom and -n specifies the number you want to show.

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

    • Use nano command to create the colors.txt file.

    • Use cat command to show the content of a file.

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

    • Write the given content in sequence to the colors.txt file you created before.

    • Use cat colors.txt command to show all the content in sequence.

  7. To find the difference between fruits.txt and Colors.txt file:

    • Use diff command to show the difference between fruits.txt and colors.txt files.