Similarly, we can use the command trash-empty where days represent the number of days that the files have been in trash-can. To verify that the trash is empty we again used the trash-list command which returned no values as expected. Then used the command trash-empty to empty the trash and We first used the command trash-list to list all the files in the trash Now, let's have a look at how can we delete files from trash Note: In some Linux Distributions the command for restore could be trash-restore.So if you try to use restore-trash command and get command not found then you can try trash-restore. To verify that the file was restored we checked trash-list to confirm that the file is not present in the trash any more and then used ls command to confirm that the file has been restored. Our aim was to restore file1 which was on index 1 so we entered 1. In the above example, we use the command restore-trash which presents us with all the files in the trash indexed starting from 0. Wait, the main benefit of moving the files to the trash instead of deleting the files permanently is that we can restore files from trash so is that possible using trash cli? How to delete files using the trash command.Similarly, you can try to use all the other wildcards with the trash command and let me know if you face any challenges. *txt represents all the files that end with ".txt". In the above example, we use the wildcard * and created a command trash *.txt where Now we know how to delete single or multiple files.Ĭan we use wildcards with the trash command? So, we have now confirmed that the files are not being deleted permanently. In the above example, we used the trash-list command and found all the files that we recently deleted. We use the trash-list command to list all the files that are present in our trash. Hmmm, Let's list all the files from our trash How can we check if the files have been moved to our trash or they have been permanently deleted? In the above example, we use the command trash file1 file2 whereįile1 file2 represents files to be deleted To delete a file using trash we only need to use the trash command along with file_name. Now that we know how to install trash-cli.Let's start exploring how can we use trash-cli. If even this method is not possible for any reason So first we install the pip using the following command :Īfter the pip has been installed successfully we use the following command to install the trash-cli : What if it's not present in the repositories? The trash-cli is present in repositories of most of the Linux Distributions. There are three ways we can install the trash-cli The first question that comes to the mind is how do we install it? Trash-cli is a command-line interface to the trash-can used by Linux Systems. Yes, Today we are going to look at trash-cli. What if I tell you that we can use something that will act as our recycle bin and will not delete the files and directories permanently. Yeah sure we can recover from the disk but it will cost a lot of time and we were using CLI to save the time in the first place. So what's the big deal, We can still recover the files we mistakenly deleted. The rm command permanently deletes the files and directories. Recently, we looked at how to delete files and directories in the Linux system where we learned and used the rm command, but there was a huge problem with the rm command.
0 Comments
Leave a Reply. |