How can I display contents of trash using terminal?

Solution 1:

You can run

ls -al ~/.Trash

to show the content of the Trash of the current user.

To see the content of all Trashes, use

sudo ls -al /Users/*/.Trash

from an admin account.

And if you also want to include the content of the Trash on external volumes, use

sudo sh -c 'ls -al /Volumes/*/.Trashes/*/'

Solution 2:

Your Trash is a unison of the directory ~/.Trash and the .Trashes directory on any other mounted file systems. To view the contents of the GUI Trash in your shell

    ls ~/.Trash /Volumes/*/.Trashes/$(id -u) 2>/dev/null