Home Directories in the Filesystem
Users’ personal files are found in the /Users directory. Each user has a
subdirectory named /Users/your-username:
take for example, /Users/smith or
/Users/jones. This is called your
home directory. OS X provides several ways to
locate or refer to your home directory:
- In the Finder
On the left side of a Finder window, you may see an icon labeled with your username (e.g., “Smith”). This represents the home directory /Users/smith. Click it to access your home directory via the Finder. If you don’t see this icon, you can add it: visit the Finder menu, choose Preferences, click Sidebar, and add the icon.
cdWith no arguments, the
cdcommand returns you (i.e., sets the shell’s working directory) to your home directory:HOMEvariableThe environment variable
HOME(see Shell variables) contains the name of your home directory.➜
echo $HOMETheechocommand prints its arguments /Users/smith˜When used in place of a directory, a lone tilde is expanded by the shell to the name of your home directory.
➜
echo ˜/Users/smithWhen followed by a username (as in ~fred), the shell expands this string to be the user’s home directory:
➜
cd ˜fred➜pwdThe “print working directory” command /Users/fred
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access