Skip to main content

Command Palette

Search for a command to run...

Day 3 of the 90DaysOfDevOps Challenge: Exploring Essential Linux Commands

Updated
3 min read
Day 3 of the 90DaysOfDevOps Challenge: Exploring Essential Linux Commands

Introduction:

Welcome back to my 90DaysOfDevOps Challenge journey! With each passing day, our knowledge of DevOps and Linux grows stronger. On Day 3, we're diving deeper into the world of Linux by exploring a set of fundamental commands. These commands are the building blocks of Linux proficiency and will prove invaluable in our DevOps quest.

Day 3 Task: Basic Linux Commands

Today's goal is to familiarize ourselves with Linux commands that DevOps enthusiasts should be familiar with. let's get started.

Viewing the Contents of a File

To view the contents of a file, we can use the cat command. Simply open your terminal and type:

# View contents of a file in a terminal
cat filename.txt

Replace filename.txt with the name of the file you want to view.

Changing File Permissions:

File permissions can be adjusted using the chmod command. Here's an example of changing permissions on a file:

Each file in Linux has its own permission owner and group

  • Permission: Determines who can read, write, or execute the file.

  • Owner: The user who owns the file and can modify its permissions.

  • Group: A user group assigned to the file, with its own set of permissions.

OctalString RepresentationBinaryPermissions
7rwx111Read+Write+Execute
6rw-110Read+ Write
5r-x101Read+ Execute
4r--100Read
3-wx011Write + Execute
2-w-110Write
1--x001Execute
0---000No Permission
# Changes Permission
chmod 644 devops.txt
  • owner (user) is granted read(4) and write(2) permissions, which together is 6.

  • group that owns the file is granted read (4) permission.

  • Others (everyone else) are also granted read (4) permission.

Viewing Command History:

To review the commands you've executed so far, history command is used. Just type:

# Lists all the commands executed so far
history

Removing a Directory/Folder:

To delete a directory, use the rmdir command. For example:

# Removes the directory
rmdir directoryname

learn directory is deleted

Creating and Viewing Files:

You can create and view file contents using the touch and cat commands. For instance, to create and view the content of a fruits.txt file:

# Create a file name fruits.txt
touch fruits.txt
# View the contents in fruits.txt
cat fruits.txt

Displaying Top and Bottom Entries:

You can use the head and tail commands to display the top and bottom entries of a file. For instance:

# Displays the top three entries
head -3 fruits.txt
# Displays the bottom three entries
tail -3 fruits.txt

Comparing Files:

diff file1.txt file2.txt

Conclusion:

Day 3 of the 90DaysOfDevOps Challenge has been all about gaining proficiency in essential Linux commands. These commands are the foundation of Linux skills and will greatly benefit us on our DevOps journey.

Stay tuned for Day 4, where we'll continue to expand our Linux knowledge and explore more practical applications. If you have any questions or topics you'd like me to cover during this challenge, feel free to leave a comment or reach out on social media. Together, we'll learn and grow in the world of DevOps!

#trainwithshubham #90DaysDevOps #DAY03-90DaysDevOps