From Wikipedia, the free encyclopedia
A home directory is a file system directory on a multi-user operating system containing files for a given user of the system. The specifics of the home directory (such as its name and location) are defined by the operating system involved; for example, Linux / BSD (FHS) systems use /home/⟨username⟩
or /usr/home/⟨username⟩
and Windows systems since Windows Vista use \Users\⟨username⟩
.[1]
A user’s home directory is intended to contain that user’s files; including text documents, music, pictures, videos, etc.[2] It may also include their configuration files of preferred settings for any software they have used there and might have tailored to their liking: web browser bookmarks, favorite desktop wallpaper and themes, stored passwords to any external services accessed via a given software, etc. The user can install executable software in this directory, but it will only be available to users with permission to execute files in this directory. The home directory can be organized further with the use of sub-directories.
The content of a user’s home directory is protected by file-system permissions, and by default is accessible to all authenticated users and administrators.[3] Any other user that has been granted administrator privileges has authority to access any protected location on the file system including other users’ home directories.
Separating user data from system-wide data avoids redundancy (the same system files can be used by between different users) and makes backups of files that are important for a specific user simpler.
Furthermore, Trojan horses, viruses, and worms running under the user’s name and with their privileges will in most cases only be able to alter the files in the user’s home directory, and perhaps some files belonging to workgroups the user is a part of, but not actual system files, reducing the chances of harming the functioning of the operating system.[4]
Location per operating system[1]
Operating system | Path | Environment variable |
---|---|---|
AT&T Unix (original version) | /usr/⟨username⟩
|
$HOME
|
Unix-derived | /var/users/⟨username⟩ /u01/⟨username⟩ /usr/⟨username⟩ /user/⟨username⟩ /users/⟨username⟩
|
|
Unix-based [5] | /home/⟨username⟩
|
|
BSD / Linux (FHS) | /home/⟨username⟩ or /usr/home/⟨username⟩
|
|
SunOS / Solaris | /export/home/⟨username⟩
|
|
macOS | /Users/⟨username⟩
|
|
Android | /data/media/⟨userid⟩
|
|
Windows NT 4.0 | \WINNT\Profiles\⟨username⟩
|
%USERPROFILE% %HOMEDRIVE%%HOMEPATH%
|
Windows 2000, XP, and Server 2003 | \Documents and Settings\⟨username⟩
|
|
Windows Vista and later | \Users\⟨username⟩
|
The file /etc/xdg/user-dirs.defaults
on many Linux systems defines the subdirectories created for users by default. Creation is normally done with the first login by Xdg-user-dirs, a tool to help manage «well known» user directories like desktop, downloads, documents, pictures, videos, or music. The tool is also capable of localization (i.e. translation) of the folders’ names.[6]
In Unix, the working directory is automatically set to a user’s home directory when they log in. In many built-in commands, typing the ~
(tilde) character is equivalent to specifying the current user’s home directory.
The Unix superuser has access to all directories on the file system, and hence can access home directories of all users. The superuser’s home directory on older systems was /, but on many newer systems it is located at /root (Linux, BSD), or /var/root (macOS).
In the OpenVMS operating system, a user’s home directory is called the root directory, and the equivalent of a Unix/DOS/Windows/AmigaOS root directory is referred to as the Master File Directory.[7][8]
Single-user operating systems
[edit]
Single-user operating systems simply have a single directory or partition for all user files, there is no individual directory setup per user (though users can still setup and maintain directories inside this main working directory manually).
- AmigaOS versions 2 and up have «System» and «Work» partitions on hard disks by default.
- BeOS (and its successors) have a /home directory which contains the files belonging to the single user of the system.
- Versions of Windows prior Windows 95 OEM Service Release 2 did not have a user folder but, since that release, C:\My Documents became in-effect the single user’s home directory.
- NeXTSTEP and OPENSTEP in a single-user, non-networked setup,
/me
is used, as well as/root
when logged in as superuser.
- Directory (computing)
- Filesystem Hierarchy Standard
- My Documents
- Root directory
- Working directory
- ^ a b «Where is my user home directory?». DownUnder GeoSolutions. Retrieved 22 February 2024.
- ^ «What is a Home Directory? – TecAdmin». 2023-05-15. Retrieved 2023-09-23.
- ^ Brown, Paul. «Classic SysAdmin: The Linux Filesystem Explained». The Linux Foundation. The Linux Foundation. Retrieved 8 December 2023.
- ^ Shimeall, Timothy J.; Spring, Jonathan M. (2014). Introduction to information security: a strategic-based approach (First ed.). Amsterdam Heidelberg: Syngress, an imprint of Elsevier. ISBN 978-1-59749-969-9.
- ^ «Home Directory Definition». Accessed on July 23, 2009
- ^ «Xdg-user-dirs-0.17 – Beyond Linux From Scratch (System V Edition), Chapter 11. General Utilities». linuxfromscratch.org. Retrieved 2022-02-01.
- ^ «OpenVMS User’s Manual». odl.sysworks.biz. Retrieved 8 December 2023.
- ^ «Master file directory — VSI OpenVMS Wiki». wiki.vmssoftware.com. Retrieved 8 December 2023.
Understanding how to access the home directory, often known as the user profile directory, is fundamental for efficient navigation and management of the individual files, settings, and configurations on a Windows system. The home directory serves as a centralized hub where the personalized data resides, encompassing documents, downloads, desktop items, app settings, and much more. This tutorial provides 2 methods how to get home directory on Windows.
Method 1 — CMD
To obtain the home directory using Command Prompt (CMD), we can utilize the echo
command along with the %USERPROFILE%
environment variable, which holds the path to the user’s home directory.
echo %USERPROFILE%
Output example:
C:\Users\John
Method 2 — PowerShell
To retrieve the home directory using PowerShell, we can utilize the $HOME
automatic variable, which holds the path to the current user’s home directory.
$HOME
Successfully Tested On: Windows 7 Enterprise SP1, Windows 8 Enterprise, Windows 8.1 Enterprise, Windows 10 Enterprise versions 1507 – 1809, Windows 10 Long-Term Servicing Branch (LTSB) versions 1507 & 1607, Windows 10 Long-Term Servicing Channel (LTSC) version 1809
I found myself in a situation recently where I was working in a Windows environment and needed to locate the SYSTEM user’s home directory. When working with SCCM, SYSTEM is the account that is used when installing applications for all users using the “Install for system” option.
The home profile for SYSTEM is actually strung out over a few locations within the %SystemDrive%\Windows directory. I’ll list out a few areas of importance when dealing with this home directory.
Root
What is considered the root of the SYSTEM user’s home directory is located at: %WinDir%\system32\config\systemprofile
AppData
SYSTEM user’s AppData is located at: %WinDir%\system32\config\systemprofile\AppData
The AppData temp location is not located in AppData\Local\Temp like normal but rather at: %WinDir%\temp
Registry Hive
SYSTEM user’s HKCU registry key is located at: HKEY_USERS\.DEFAULT
This hive is stored on disk in the following file: %WinDir%\system32\config\DEFAULT
This is different than typical user hives which are stored in a file named ntuser.dat on the root of the home directory.
WSL (Windows Subsystem for Linux) is a specially created software layer by Microsoft to run Linux binary executables natively on Windows 11 or 10. When you install a Linux distribution on WSL, it creates a Linux environment within Windows, with its own file system and home directory. However, how to find this directory using Graphical File Explorer of Windows? If you don’t know that then in this article, we learn about it.
The default home directory for the user account in WSL is located at /home/<username> which can be accessed using the Command line interface of WSL running bash.
For example, if your username is H2s, your home directory in WSL would be located at /home/h2s. By default, when we start the WSL Linux app, we are in our Home directory. You can switch to that using:
cd /home
The working of the home directory in WSL Linux is similar to the traditional Linux distros we are running on virtual machines, containers, or bare systems. It holds all files related user’s personal files and configuration settings. All the files of the home directory are only meant to use for your WSL instance and will not interfere with the Windows file system or vice versa…
Although we are showing this tutorial using for Ubuntu subsystem, the process will be the same for others too such as OpenSUSE, Kali, and Debian installed on WSL.
Steps to Find the WSL home directory using the GUI file explorer of Windows
- On your Windows 10 or 11, go to File Explorer or simply open MyPC to get it for finding the WSL Linux app home folder.
- After that from the left side panel scroll down to the end.
- Open WSL Linux File Explorer: There you will see the Linux Penguin icon, click that.
- Now, all the installed Linux apps such as Ubuntu, Debian, Kali, etc. on your WSL will show in the folder.
- For example, if we open the Ubuntu folder then inside that we will have a directory called ‘home‘. Open that and you will find the user of that WSL Linux app along with other files.
- After selecting the Linux WSL app, open the Home directory you want to explore manually using the GUI.
Additional tip:
To access all Windows 11 or 10 system drives under the Command Terminal of Ubuntu or another Linux environment installed on Windows WSL; we need to follow the mounting command of Linux.
Note: One thing to be mentioned is that the Bash Shell of the Linux environment should be launched under the Administrative right to access the system folders of Windows. To give administrative permission just right-click on the installed Linux environment such as Ubuntu and select “Run as Administrator”.
From your Linux Bash Shell type the following command to mount C: Drive:
cd /mnt/c ls
In the same way for D: drive type
cd /mnt/d ls
In this way, we can also mount both internal and external drives attached to our Windows 11 or 10 systems including the network drives.
Other Articles:
- Install Git LFS on WSL2 – Windows 11 or 10?
- How to install Anaconda on WSL Windows 10/11 using Ubuntu Linux App
- How to install Oracle Linux on Windows 10 or 11 WSL – Subsystem
- Install WSL- Windows Subsystem for Linux on Windows 11