DEV Community

Cover image for Hands-on Basic Linux Commands: #Day3 of 90DaysofDevOps
On-cloud7
On-cloud7

Posted on

1 1 1 1 1

Hands-on Basic Linux Commands: #Day3 of 90DaysofDevOps

Task: What is the Linux command to:

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

Viewing the Contents of a File: You can use the cat command to see what's written in a file. For example:

Image description

Image description

2. To change the access permissions of files.
To modify the access permissions of files, you can use the chmod command. For instance:

Image description

Image description

  1. chmod +rwx filename to add permissions

  2. chmod -rwx directoryname to remove permissions.

  3. chmod +x filename to allow executable permissions.

  4. chmod -wx filename to take out write and executable permissions.

Image description
There are three options for permission groups available to you in Linux.

owners: these permissions will only apply to owners and will not affect other groups.

groups: you can assign a group of users specific permissions, which will only impact users within the group.

users: these permissions will apply to all users, and as a result, they present the greatest security risk and should be assigned with caution.

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.

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

Image description

Image description
4. To remove a directory/ Folder.

Image description

Image description
5. To create a fruits.txt file and to view the content.

Image description

Image description

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

Image description

Image description
7. Show only the top three fruits from the file.

Image description

Image description
8. Show only the bottom three fruits from the file.

Image description

Image description

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

Image description

Image description

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

Image description

Image description
11. To find the difference between fruits.txt and Colors.txt files.

Image description

Image description

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay