Find a File

LinuxLinuxBeginner
Practice Now

Introduction

There's an important document (sources.list) on your computer, but you can't remember its exact location. You vaguely recall that it's somewhere in the /etc/ directory. Your task is to find this file and modify its access permissions so that you're the only user authorized to access it.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/PackagesandSoftwaresGroup(["`Packages and Softwares`"]) linux(("`Linux`")) -.-> linux/FileandDirectoryManagementGroup(["`File and Directory Management`"]) linux(("`Linux`")) -.-> linux/UserandGroupManagementGroup(["`User and Group Management`"]) linux(("`Linux`")) -.-> linux/BasicFileOperationsGroup(["`Basic File Operations`"]) linux/PackagesandSoftwaresGroup -.-> linux/apt("`Package Handling`") linux/FileandDirectoryManagementGroup -.-> linux/find("`File Searching`") linux/UserandGroupManagementGroup -.-> linux/sudo("`Privilege Granting`") linux/BasicFileOperationsGroup -.-> linux/chown("`Ownership Changing`") linux/BasicFileOperationsGroup -.-> linux/chmod("`Permission Modifying`") subgraph Lab Skills linux/apt -.-> lab-17993{{"`Find a File`"}} linux/find -.-> lab-17993{{"`Find a File`"}} linux/sudo -.-> lab-17993{{"`Find a File`"}} linux/chown -.-> lab-17993{{"`Find a File`"}} linux/chmod -.-> lab-17993{{"`Find a File`"}} end

Find and Change the File Owner

In this challenge, you need to locate the sources.list file and change its ownership.

Tasks

  1. Find the sources.list file. If multiple files are found, choose the one with the shortest path.
  2. Change the file owner to yourself (the labex user).
  3. Set the access permissions so that only you can read and write this file.

Example

After successfully completing the tasks, the file information should look similar to this:

$ ls -l /etc/apt/sources.list
-rw------- 1 labex root 2403 Feb 6 10:14 /etc/apt/sources.list

Summary

Congratulations! You have successfully completed this challenge. You've practiced using commands to search for files, change file ownership, and modify file permissions. These skills are essential for effective file management and security in Linux systems.

Other Linux Tutorials you may like