0
0
Linux CLIscripting~15 mins

chown (change ownership) in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Change File Ownership with chown
📖 Scenario: You are managing files on a Linux system. Sometimes, you need to change who owns a file or directory to keep things organized and secure.
🎯 Goal: Learn how to use the chown command to change the ownership of files and directories.
📋 What You'll Learn
Create a file named example.txt
Create a variable with the username user1
Use chown to change the owner of example.txt to user1
Display the ownership details of example.txt using ls -l
💡 Why This Matters
🌍 Real World
System administrators often need to change file ownership to control access and permissions for different users.
💼 Career
Knowing how to use <code>chown</code> is essential for Linux system administrators, DevOps engineers, and anyone managing multi-user systems.
Progress0 / 4 steps
1
Create a file named example.txt
Create an empty file called example.txt using the touch command.
Linux CLI
Need a hint?

Use touch example.txt to create an empty file.

2
Create a variable with the username user1
Create a variable called username and set it to user1.
Linux CLI
Need a hint?

Use username=user1 to set the variable.

3
Change ownership of example.txt to user1
Use the chown command with the variable username to change the owner of example.txt.
Linux CLI
Need a hint?

Use chown $username example.txt to change ownership.

4
Display ownership details of example.txt
Use ls -l example.txt to display the ownership details of the file.
Linux CLI
Need a hint?

Use ls -l example.txt to see the owner and group of the file.