list all users linux in directory code example Example 1: list users in linux cat /etc/passwd Example 2: get users shell getent passwd $LOGNAME | cut -d: -f7