get ubuntu username code example Example 1: ubuntu know username whoami or echo $USER Example 2: list users in ubuntu cut -d: -f1 /etc/passwd