Path Reference Techniques
Absolute Path References
Absolute paths provide the complete route from the root directory to a specific location.
## Full path to home directory
/home/username
## Example of absolute path
/home/username/Documents/report.txt
Relative Path References
Relative paths describe location in relation to the current working directory.
## Current directory
.
## Parent directory
..
## Navigate up one directory
cd ..
## Navigate to subdirectory
cd Documents
Tilde (~
) References
The tilde provides quick access to home directory paths.
## Shortcut to home directory
cd ~
## Reference another user's home directory
cd ~otheruser
## Create file in home directory
touch ~/newfile.txt
Path Reference Methods
Method |
Syntax |
Example |
Absolute |
Full path |
/home/username/Documents |
Relative |
Current directory context |
./Documents |
Tilde |
Home directory shortcut |
~/Documents |
Advanced Path Manipulation
## Resolve full path
readlink -f ~/Documents
## Get current working directory
pwd
Path Expansion Techniques
graph TD
A[Path Expansion] --> B[Wildcard *]
A --> C[? Single Character]
A --> D[[] Character Range]
Practical Path Reference Examples
## Copy file using path references
cp ~/Documents/file.txt /tmp/
## Move between directories
cd ~/Downloads
LabEx Insight
LabEx environments provide hands-on practice for mastering path reference techniques in Linux systems.
Best Practices
- Use relative paths for portability
- Understand path context
- Leverage tilde for quick home directory access
- Practice path navigation consistently