💻 Software
The CD command with "-" argument will change to previous directory. Is there a way to know which directory it is?
Fresh5 days ago
Mar 15, 2026414 viewsConfidence Score0%
0%
Problem
The command cd - will change the pwd to the last directory. Is there a way to know which directory it is, so that I'll know where I am CD'ing to?
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: The CD command with "-" argument will change to previous directory. Is there a way to know which directory it is?
Low Risk
Yes, it is $OLDPWD.
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix