File Management Fundamentals

LinuxLinuxBeginner
Practice Now

Introduction

In this challenge, you will use touch command to create files, use ls command to view file properties, use chmod to modify file properties and use chown to change file owner.

Achievements

  • ls - list files and file properties.
  • touch - create files.
  • vim - open and save file.
  • chmod - change file permissions.
  • chown - change file owner.

Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/BasicSystemCommandsGroup(["`Basic System Commands`"]) linux(("`Linux`")) -.-> linux/BasicFileOperationsGroup(["`Basic File Operations`"]) linux(("`Linux`")) -.-> linux/UserandGroupManagementGroup(["`User and Group Management`"]) linux(("`Linux`")) -.-> linux/VersionControlandTextEditorsGroup(["`Version Control and Text Editors`"]) linux/BasicSystemCommandsGroup -.-> linux/test("`Condition Testing`") linux/BasicFileOperationsGroup -.-> linux/ls("`Content Listing`") linux/UserandGroupManagementGroup -.-> linux/sudo("`Privilege Granting`") linux/BasicFileOperationsGroup -.-> linux/touch("`File Creating/Updating`") linux/BasicFileOperationsGroup -.-> linux/chown("`Ownership Changing`") linux/BasicFileOperationsGroup -.-> linux/chmod("`Permission Modifying`") linux/VersionControlandTextEditorsGroup -.-> linux/vim("`Text Editing`") subgraph Lab Skills linux/test -.-> lab-7779{{"`File Management Fundamentals`"}} linux/ls -.-> lab-7779{{"`File Management Fundamentals`"}} linux/sudo -.-> lab-7779{{"`File Management Fundamentals`"}} linux/touch -.-> lab-7779{{"`File Management Fundamentals`"}} linux/chown -.-> lab-7779{{"`File Management Fundamentals`"}} linux/chmod -.-> lab-7779{{"`File Management Fundamentals`"}} linux/vim -.-> lab-7779{{"`File Management Fundamentals`"}} end

Create Files

This challenge is about craeting files.

Try to create a file named test.cpp in the ~ directory and create a file named main.cpp in the ~/Code directory.

Example

challenge-file-properties-1-1

Requirements

~ is the default directory in which a terminal is opened by default.

  • Create a file named test.cpp in the ~ directory with touch command.
  • Create a file named main.cpp in the ~/Code directory with touch command.

Create Files

This challenge is about opening and saving a file.

vim is a text editor that can open and save a file.

Try to create a file named main.cpp in the ~ directory with vim command.

Example

challenge-file-properties-2-1

Requirements

~ is the default directory in which a terminal is opened by default.

  • Open a file named main.cpp in the ~ directory with vim command.
  • Type #include in the file.
  • Save the file.

Modify File Permissions

This challenge is about modifying the file permissions.

Try to change the file permissions named main.cpp in the ~ directory with chmod command.

Example

challenge-file-properties-3-4

Requirements

  • Create a file named setup.sh in the ~ directory with touch command.
  • Add executable permissions to Other Users of the setup.sh script file.

Modify File Owner

This challenge is about modifying the file owner.

chown command requires superuser root privileges to execute this command.

Example

challenge-file-properties-4-1

Requirements

  • Create a file named setup.sh that belongs to user labex in the ~ directory.
  • Change the file owner to root.

Summary

Congratulations! You have completed the basic operations challenge.

In this challenge, you learned five basic operations commands ls, touch, vim, chmod, chown.

These commands that are used frequently, so be sure to keep them in mind.

Keep exploring!

Other Linux Tutorials you may like