To change an existing user's home directory, you can use the usermod command with the -d option. Here’s the syntax:
sudo usermod -d /new/home/directory username
For example, if you want to change the home directory of a user named joker to /home/wayne, you would run:
sudo usermod -d /home/wayne joker
If you also want to move the contents of the old home directory to the new one, you can use the -m option:
sudo usermod -d /home/wayne -m joker
This command will change the home directory and move the files from the old directory to the new one.
