A file path is a string that identifies where a file or directory lives in a file system. An absolute path starts at the root, while a relative path starts from the current working directory.
Why it matters
Wrong paths cause many everyday errors such as file not found. Windows uses drive letters and backslashes, like C:\Users\dev\notes.txt, while Linux and macOS use forward slashes starting at a single root, like /home/dev/notes.txt. Web URLs also use forward slashes, but a URL path is not a file path on the server.
Symbols such as . (current directory) and .. (parent) shorten relative paths.
Example
# current directory: /var/www/site
./images/logo.png -> /var/www/site/images/logo.png
../backup/db.sql -> /var/www/backup/db.sql
Common mistakes
- Hard-coding absolute paths in scripts that later move to another machine.
- Forgetting that Linux paths are case-sensitive, so Logo.png and logo.png differ.
- Not quoting paths that contain spaces on the command line.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.