How can I list only hidden accounts with terminal command

Solution 1:

Yes you can :

dscl . -search /Users IsHidden 1 

If you just want the account names, run

dscl . -list /Users IsHidden 1 | cut -f 1 -d' '