How to Change Username in Ubuntu Linux

If you want to change the username of a user account, it can be done from the command line using the usermod command.

usermod -l new_name old_name

For example, let's say that you have a user account named rob in your Ubuntu Server and you want to change username to john. The following commands will take care of that:

usermod -l john rob

In the example, we're changing the login name from rob to john.

However, This will NOT change the name of his home directory. You have to change the home folder manually to reflect the new username.

usermod -m -d /home/john john

In the example, we are updating the home directory to reflect the new username. The -d option sets The user's new login directory. With the -m option, usermod command in Ubuntu will Move the content of the old home directory to the new location.

If you want to change the Full name of the user (Display name), this can be done using the -c option.

usermod -c "Full Name" user_name

Full Name is the one you see in your login screen in Ubuntu Desktop.

How to Change Username in Ubuntu Linux