Changing a Linux username

Super easy:

First, call usermod -l (change login) with the -d (home) and -m (move home) args. This changes the username, moves the old home directory to the new home directory:

sudo usermod -l new_name -d /home/new_name -m old_name

Next, call groupmod –new-name to rename the user’s group.

sudo groupmod --new-name new_group_name old_group_name

Annd.. you’re done! See? Super easy.