Cannot “Move to trash” in Ubuntu

  1. Reason:

    There is no folder named .Trash-{UID}, or application doesn’t have permission to read and write file in that folder.

  2. Solution:

    Step 1: Find your UID (by default, current user has UID=1000)
    Run cat /etc/passwd | grep $(whoami)
    Result looks like this: ubuntu:x:1000:1000:ubuntu,,,:/home/ubuntu:/bin/bash
    You can see 1000, it is your UID.
    Step 2: Create trash folder for current user
    Run sudo mkdir .Trash-1000, you get 1000 from previous step.
    If folder exists, you can ignore this step.
    Step 3: Set permission for created trash folder.
    sudo chown $(whoami):$(whoami) .Trash-1000

Now, you can move file to trash.