move to trash works in /home, but not in the root directory /.

I want to delete a file from /opt/lampp directory, but I get the question of whether I'd like to delete the file permanently.

Here is partition detail:

  • /dev/sda5 is mounted on /home
  • /dev/sda6 is mount on /
  • That is the expected behavior. In the former you have all the permissions whereas in the latter only root has. – user692175 Jul 20 '17 at 4:12
  • then how can we solve it ??? – Mohit Jul 20 '17 at 4:18
  • Not a problem, it's by design. Nothing to solve and for your system's sake stop messing with system files. – user692175 Jul 20 '17 at 4:20
  • i need this for development purpose. so i need move to trash option many times. – Mohit Jul 20 '17 at 4:22
  • i use this command, where i want to add move to trash but it is also not working... sudo mkdir .Trash-$UID && sudo chown $USER:$USER .Trash-$UID – Mohit Jul 20 '17 at 4:35

You are probably trying to solve a problem in a fundamentally wrong way, and since you don't describe your problem - that is what you want to achieve or why you want to use trash I can only speculate on alternative approaches.

The easiest way for you to achieve undeletion is of course not to remove the file at all. Rather, you can rename it in a way that it is no longer found by the XAMPP installation, or move it for safe keeping in another directory, taking note of where it were, in case you need to restore it. (This is actually what trash does.)

What you probably want to do, however, judging from your statement in a comment that you are doing this for development purposes, is to version control your XAMPP installation. This will give you not only the ability to restore removed files, but also to track edits and added files, and be able to restore any point in the history of your development.

The good news is that it is really not that hard. Go to the /opt/lampp directory, and type

$ git init
$ git add *
$ git commit

This will give you a clean starting point in your version history.


$ git rm <file>

to remove a file, and then commit your change. You can check your commit history with

$ git log

and if you change your mind, you can revert a change with the

$ git revert <id>

-command, where is the number displayed by git log.

Good luck!

| improve this answer | |
  • I want to move any file into trash from slash directory bt it is not work. it ask me to delete permanently. – Mohit Jul 20 '17 at 11:16
  • Why do you want to do that? – Bex Jul 20 '17 at 14:40
  • hello i just create a .Trash-1000 in / directory. now i have move to trash option and deleted files are move to this folder. but now i want this deleted file show in ~/.local/share/Trash with restore option. please help me. i heard about symlink concept, if you have any idea then please share with me. – Mohit Jul 21 '17 at 6:55
  • @Mohit this is still the wrong solution. Why do you want this? Why do you want trash and restore options for these files? Why do you want to remove them in the first place? – Bex Jul 21 '17 at 7:15
  • Trash is not working in / (slash) directory. i want to delete or create or restore file frequently. i am working in /opt/lampp/htdocs directory but there is no move to trash option. I google for this problem then i find that trash is working in only home directory so i create a another trash for my problem now problem is resolved because i can see my move to trash files in a folder but still there is issue that i dont have any option to restore. – Mohit Jul 21 '17 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.