Skip to main content

Creating, Moving, and Deleting Files

Hands-On Lab

 

Photo of Michael Christian

Michael Christian

Course Development Director in Content

Length

00:45:00

Difficulty

Beginner

In this hands-on lab, we will practice creating, moving, and deleting files. the ability to create, move, and delete files and folders is a necessary step in working with a Linux filesystem. By the end of this lab, the student will be familiar with creating, moving, and deleteing files and folders in Linux.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Creating, Moving, and Deleting Files

Introduction

In this hands-on lab, we will practice creating, moving, and deleting files.

Connecting to the Lab

  1. Open your terminal application, and run the following command (remember to replace <PUBLIC_IP> with the public IP you were provided on the lab instructions page):
    ssh cloud_user@<PUBLIC_IP>

Copy/Move the Requested Files and Folders

  1. List the current working directory.
    pwd
  2. List the contents of the current working directory.
    ls
  3. List the contents of the Practice folder.
    ls Practice/
  4. Copy ~/Practice/Test to a new folder namedReport.
    cp -R Practice/Test/ Report
  5. Change to the Report directory.
    cd Report/
  6. List the content of the Report folder we just created.
    ls
  7. Rename and move ~/Report/sos_commands/filesys/mount_-l to ~/Report/mounts.txt.
    mv sos_commands/filesys/mount_-l mounts.txt
  8. Verify that this was successful.
    ls

Remove the Requested Files and Folders

  1. List the contents of the etc/ directory.
    ls etc/
  2. Remove etc/selinux/ from the ~/Report/ directory.
    rm -rf etc/selinux/
  3. Remove var/log/boot.log
    rm -rf var/log/boot.log
  4. List the contents of the proc/ folder.
    ls proc/
  5. Remove anything in proc/ that is or starts with a number.
    rm -rf proc/[1-9]*
  6. Verify that this was successful.
    ls proc/
  7. List the contents of the etc/ directory that end in .conf.
    ls etc/*.conf
  8. Remove anything in etc/ that ends in .conf
    rm -rf etc/*.conf
  9. Verify that this was successful.
    ls etc/*.conf
  10. List the contents of the sys/module/ directory that start with ip6t.
    ls sys/module/ip6t*
  11. Remove anything in sys/module that starts with ip6t.
    rm -rf sys/module/ip6t*
  12. Verify that this was successful.
    ls sys/module/ip6t*

Create a New File in ~/Report/

  1. Run the following command:
    touch Done.txt

Conclusion

Congratulations, you've successfully completed this hands-on lab!