-
-
Notifications
You must be signed in to change notification settings - Fork 2
Linux pwd Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to pwd on Linux, covering Arch Linux, CachyOS, and other distributions including showing current directory, absolute paths, and directory information.
pwd (print working directory) shows current directory.
Uses:
- Current location: See where you are
- Absolute path: Get full path
- Scripts: Use in scripts
- Navigation: Confirm location
Why it matters:
- Orientation: Know your location
- Scripts: Reference current directory
- Debugging: Verify paths
Basic usage:
# Show current directory
pwd
# Output: /home/usernamePath types:
# Physical path (follows symlinks)
pwd -P
# Logical path (default)
pwd -LUse in scripts:
#!/bin/bash
CURRENT_DIR=$(pwd)
echo "Current directory: $CURRENT_DIR"Store path:
# Store in variable
DIR=$(pwd)
cd /other/directory
cd "$DIR"Check location:
# Before changing
pwd
# Change directory
cd /some/path
# Verify
pwdCheck installation:
# Check pwd
which pwd
# Usually in coreutils
# Install if missing
sudo pacman -S coreutilsThis guide covered pwd usage, current directory display, and path information for Arch Linux, CachyOS, and other distributions.
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.