Let’s say I have the username of tom and my main group is also tom.
For some reason I now need my username to be jerry and in the group jerry.
sudo usermod -l jerry tom
That changed the username from tom to jerry. But jerry is still in the group tom.
sudo groupmod -n jerry tom
Okay. Now jerry is in the group jerry. But all jerry’s files are still in /home/tom.
sudo usermod -m -d /home/jerry jerry
Voila! Now tom is jerry.