Introduction:
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:
Versatility: Linux commands are versatile and can be used for a wide range of tasks, from system administration to automation to troubleshooting.
Career Opportunities: Proficiency in Linux commands is often a prerequisite for job roles in IT, DevOps, system administration, and cybersecurity.
Server Administration: Linux is the dominant choice for server operating systems, making Linux command knowledge crucial for managing servers and cloud infrastructure.
Automation: Linux commands enable you to automate repetitive tasks and workflows, improving efficiency and reducing errors.
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:
To view what's written in a file:
- cat is this command to show what's written in a file.
To change the access permissions of files:
- chmod is the command to change the permissions of files.
To check which commands you have run till now:
- history is the command to check the commands you recently run.
To remove a directory/ Folder:
- rm -r is the command to remove a directory or a folder.
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.
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.
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.
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.
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.
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.
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.