In the next article I will show you how to manage the recycle bin from the terminal of our operating system Ubuntu.
Surely you are thinking that because it serves this purpose, as we can do everything from the graphical interface of our system, and I must tell you that it is indeed much easier to do it graphically, but I must also tell you that it is never too late to know how the terminal works, And that is what we are actually doing when we move, delete or restore a file or directory from the Recycle Bin.
First of all, it will open a new terminal:
Now we need to know which route it is on the recycling bin of our operating system, and in this case, Ubuntu, We can find it in the route:
.local / share / Trash / files
So to access from the terminal we must write:
cd ~ / .local / share / Trash / files
Now for list or view content we have in the trash we will use the ls command:
As we can see in the screenshot above, I just got it 3 files created especially for this tutorial, so we can see a folder called folder, A document called document and another document called untitled document.
How to delete a document, file or directory
per remove completely a file or document we will use the command rm, For example, to delete the document we will write in the terminal:
if we wanted to delete the folder, We should write rm -r:
rm -r Folder
To restore the items we want from the trash we will do it in two ways, or movent to another directory or copying them.
With the order mv we will move them wherever we want:
mv document / home / francisco / Documents
With this line we will move the document to our directory personal folder Documents, Logically we will have to change the username for our user.
per copy we will do the same but with order cp:
cp document / home / francisco / Documents
Finally, for empty completely the recycling bin, wherever we are, that is, without being directly on the road /.local/share/Trash/files, We will type the following line in the terminal:
rm -r /home/francisco/.local/share/Trash/files/*
Notice that at the end of the line is an asterisk* and that we will have to change francisco per your username.
This is the only command we can run from anywhere in the terminal, the others must be positioned in the route specified above which is where the Ubuntu recycle bin is located.
More information – Entering the terminal: basic commands