Introduction
In this project, you will learn how to create a custom rm
command that moves deleted files to a trash directory instead of permanently deleting them. This is a useful feature to have on your Linux server to prevent accidental deletion of crucial files.
ð Preview
labex:project/ $ ll /tmp/trash
total 2.0K
-rw-r--r-- 1 labex labex 8 Oct 26 17:47 trash_file.md
ðŊ Tasks
In this project, you will learn:
- How to set up the
/tmp/trash
directory to store deleted files temporarily - How to create a custom
rm
command script that moves deleted files to the trash directory - How to update the
PATH
environment variable to use the customrm
command - How to test the custom
rm -f
command to ensure it is working as expected
ð Achievements
After completing this project, you will be able to:
- Protect your Linux server from accidental file deletion by implementing a custom
rm
command with a trash directory - Understand how to modify system commands to change their default behavior
- Gain experience in shell scripting and environment variable management