What does the -d flag do in the usermod command?

QuestionsQuestions8 SkillsProUser Account ManagementAug, 17 2025
0188

The -d flag in the usermod command is used to change the home directory of a user. When you specify this flag, you need to provide the new home directory path as an argument.

For example:

sudo usermod -d /new/home/directory username

This command changes the home directory of the user username to /new/home/directory. If you want to move the contents of the old home directory to the new location, you can use the -m flag along with -d.

0 Comments

no data
Be the first to share your comment!