Try on DesignSafe

Root & Home Paths#

by Silvia Mazzoni, DesignSafe, 2025

When working in Jupyter environments, the full absolute path is often hidden behind a simplified interface. You typically start navigating at directories like MyData, Work, or MyProjects, without seeing the full path that comes before them. However, these base paths do exist—and they vary depending on the system you’re using.

On DesignSafe, this is especially important because the same storage systems appear differently across platforms. For example:

  • JupyterHub mounts MyData under /home/jupyter/MyData/

  • Stampede3 doesn’t mount MyData at all, but uses your $HOME directory instead, which is part of a different storage system.

  • Tapis uses URI-style paths like tapis://designsafe.storage.default/username/ (more on this later…)

Understanding these differences is key to writing scripts and workflows that are portable and error-free across all of DesignSafe’s environments.

The root directory (/) vs. your home directory (~)#

When talking about file systems on UNIX-like systems (including Linux, macOS, and the systems powering JupyterHub and Stampede3), it’s important to distinguish between:

  • The root directory / This is the top of the entire file system hierarchy. Everything on the machine—system files, programs, shared data, and user directories—lives somewhere under /.

    Examples of absolute paths from root include::

    /
    /home
    /scratch
    /usr/bin
    
  • Your home directory ~ This is a shortcut to your personal user space, sometimes called your “home directory.” It’s where your files, configurations, and most project work reside. Typical absolute equivalents look like:

    /home/silvia
    or
    /Users/silvia
    

In other words, / is the root for the whole machine, while ~ is the root for your own user environment. That’s why ~ is sometimes described as “the root of your personal space.”

Why does this matter?#

  • When you use / to start a path, you’re telling the system to look from the very top. For example:

    /usr/bin/python
    /scratch/myproject/output.txt
    

    These are system-level paths—they exist independently of who’s logged in.

  • When you use ~, you’re telling the system to look in your own user directory. For example:

    ~/my-scripts/run-opensees.sh
    ~/results/output.dat
    

    These are specific to your user, making them portable and safer (you won’t accidentally mess with system files).

import os

Example with / in Python#

thisPath = '/'
expanded = os.path.abspath(os.path.expanduser(thisPath))

print(f"Path: {thisPath}")
print(f"Expanded: {expanded}")
Path: /
Expanded: /
AllContents = os.listdir(expanded)
print(f"\n Get contents using: os.listdir('{thisPath}'): {AllContents}")
 Get contents using: os.listdir('/'): ['media', 'home', 'sbin', 'proc', 'boot', 'opt', 'tmp', 'usr', 'mnt', 'dev', 'var', 'sys', 'srv', 'bin', 'etc', 'run', 'lib', 'root', 'lib64', 'sbin.usr-is-merged', 'bin.usr-is-merged', 'lib.usr-is-merged']

Example with ~ in Python#

Path = '~'
expanded = os.path.expanduser(Path)

print(f"Path: {Path}")
print(f"Expanded: {expanded}")
Path: ~
Expanded: /home/jupyter
AllContents = os.listdir(expanded)
print(f"\n Get contents using: os.listdir('{Path}'): {AllContents}")
 Get contents using: os.listdir('~'): ['.profile', '.bashrc', '.bash_logout', '.tapis_tokens.json', '.local', '.ipython', '.ipynb_checkpoints', '.cache', 'Work', '.config', '.tapis-token', 'MyProjects', 'CommunityData', 'NEES', 'NHERI-Published', 'MyData', '.jupyter', '.wget-hsts', '.julia', '.bash_history', '.matlab']

This shows that "~" is not the same as /—it expands to your personal home directory.

Symbol

Means

/

root of the entire filesystem

~

your user’s home directory

In practice#

Understanding this difference is crucial when writing absolute paths.

  • If you use /, you start from the very top of the machine’s filesystem. This is required when referencing global locations or shared directories.

  • If you use ~, you start from your personal space. This is safer and more portable—especially across different systems on DesignSafe—since it doesn’t depend on system-level structures that might change.

This distinction also helps you avoid mistakes like trying to list or modify system directories (/etc, /usr) when you really meant to work inside your own files.