Question: How Do I Change the Default Home Directory in Linux?
Contents

To change default directory to /opt/, we need to change few settings as mentioned below: As the root user open /etc/default/useradd using your favorite editor. and change it to read HOME=/opt Save and close the file.

How do I change the home directory in Linux?

To change to your home directory, type cd and press [Enter]. To change to a subdirectory, type cd, a space, and the name of the subdirectory (e.g., cd Documents) and then press [Enter]. To change to the current working directory’s parent directory, type cd followed by a space and two periods and then press [Enter].

How do I change my home directory?

The working directory

  1. To navigate to your home directory, use “cd” or “cd ~”
  2. To navigate up one directory level, use “cd ..”
  3. To navigate to the previous directory (or back), use “cd -“
  4. To navigate into the root directory, use “cd /”
James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest