0
0
Linux CLIscripting~15 mins

Permission types (read, write, execute) in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Understanding Permission Types (read, write, execute) in Linux CLI
📖 Scenario: You are managing files on a Linux system. Each file has permissions that control who can read, write, or execute it. Understanding these permissions helps you keep files safe and control access.
🎯 Goal: You will create a file, set permissions, and check the permission types using Linux commands.
📋 What You'll Learn
Create a file named example.txt
Create a variable called permissions to store permission info
Use the ls -l command to get permission details
Print the permission types for the file
💡 Why This Matters
🌍 Real World
Managing file permissions is essential for protecting data and controlling access on Linux systems.
💼 Career
System administrators and developers often need to check and modify file permissions to secure systems and applications.
Progress0 / 4 steps
1
Create a file named example.txt
Use the touch command to create a file called example.txt.
Linux CLI
Need a hint?

Use touch example.txt to create an empty file named example.txt.

2
Create a variable called permissions to store permission info
Use the command ls -l example.txt and assign its output to a variable called permissions.
Linux CLI
Need a hint?

Use permissions=$(ls -l example.txt) to save the file details into the variable.

3
Extract the permission types from permissions
Use the echo command with cut to extract the first 10 characters (permission string) from the permissions variable and save it to a variable called perm_types.
Linux CLI
Need a hint?

Use perm_types=$(echo "$permissions" | cut -c1-10) to get the permission characters.

4
Print the permission types for example.txt
Use echo to print the value of the variable perm_types.
Linux CLI
Need a hint?

Use echo "$perm_types" to display the permission string.