The -m flag in the usermod command is used to move the contents of the user's current home directory to the new home directory when changing it.
Usage:
-
Syntax:
usermod -d NEW_HOME_DIR -m USERNAME -
Parameters:
NEW_HOME_DIR: The new path for the user's home directory.USERNAME: The name of the user whose home directory you want to change.
Example:
usermod -d /new/home/directory -m joker
This command changes the home directory of the user joker to /new/home/directory and moves all files from the old home directory to the new one.
Using the -m flag ensures that the user's data is preserved during the home directory change. If you have more questions, feel free to ask!
