Bash script to convert a Minecraft username to UUID

If you’re editing a Minecraft server to add an operator or set up a whitelist, and you’re not already an operator, you’ll need to convert your Minecraft user name into a UUID and edit the operators file, and for some versions the whitelist file as well. You can do this online, using for example, but if you want to automate a server setup, here’s a short bash script to do the conversion on the command line. It does it by calling the Mojang API and then adding hyphens in the right places.

The script expects a Minecraft user name as a command line parameter, and needs to run in the bash shell (as the adding hyphens part uses some bash specific syntax).

You can pick up the script from github here:

Also including it below for reference..

# Script to convert a Minecraft username to a UUID that you can use in operator/whitelist files etc.
# $1 = Minecraft user name

if [[ ! $# -eq 1 ]] ; then
    echo 'Error: Expected one argument: Minecraft user name.'
   exit 1

mojang_output="`wget -qO- $UUID_URL`"
echo $UUID

This entry was posted in Games, Linux, Ubuntu and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s