There are 2 commands in a modern Ubuntu to create new users: adduser and useradd. Unless you know what you are doing, do not use useradd.
$ sudo adduser joe
This creates a normal user, creates their home directory, copies over the dot files from /etc/skel
, requests you to set the password for this user and generally sets up everything for the user to login and use the shell.
In addition, if you also want the user directories like Desktop
, Downloads
and such to be created:
<login as joe>
$ xdg-user-dirs-update
$ sudo useradd joe
This command does not even create a home directory for the new user.
$ sudo useradd -m joe
$ sudo userdel joe
The above command does not remove the files owned by the user.
$ sudo userdel --remove-all-files joe
References:
Tried with: Ubuntu 22.04