How can I empty the trash using terminal?

Solution 1:

You can use the rm command:

rm -rf ~/.local/share/Trash/*

The rm command removes (deletes) files or directories.

-f, --force     Ignore nonexistant files, and never prompt before removing.
-r, -R, --recursive     Remove directories and their contents recursively.

The trash folder is found at: $HOME/.local/share/Trash

Be careful how you use the rm command - the files aren't sent to a trash can where you can undelete them, so it's not easy to undo.

Solution 2:

After you sudo apt install trash-cli, you can do

trash-empty

More interesting details about trash handling below and in the man page.

restore-trash (1)    - Restore for Command line trash utility.
trash (1)            - Command line trash utility.
trash-empty (1)      - Empty for Command line trash utility.
trash-list (1)       - List trashed files.
trash-put (1)        - Command line trash utility.
trash-rm (1)         - Removes files matching a pattern from the trash can