Your Ad Here

Monday, July 27, 2009

Create a file delete command that uses the trash

       As we know, the rm command doesn’t have a trash facility. Once files are deleted, they’re gone forever. However, you can create your own trash command which, when used at the prompt, will move files and/or folders to Ubuntu’s standard trash folder. The files can then be recovered, if desired, or permanently deleted in the usual way by emptying the Trash folder.

To add the new command, you’ll have to create an alias. you’ll need to edit the .bashrc file in your /home folder and add a line to the bottom, as follows:
1. Open a terminal window and type gedit  ~/.bashrc.
2. At the bottom of the file, add the following new line:
alias trash="mv -t ~/.local/share/Trash/files --backup=t" 

    Save the file, close Gedit, and open a new terminal window to test your new command. To delete filename.doc, for example, you would type trash filename.doc. The new command will work on folders too, and multiple files/folders can be specified one after the other (for example, trash filename1.doc filename2.doc).



Thank'u
By:Mr.Gm

0 komentar:

Post a Comment

 

My Room Temperature

My Pressure

My Humidity