Sample Header Ad - 728x90

Difference between "cd -" and "cd ~-"

93 votes
3 answers
112836 views
The Bash command cd - prints the previously used directory and changes to it. On the other hand, the Bash command cd ~- directly changes to the previously used directory, without echoing anything. Is that the only difference? What is the use case for each of the commands?
Asked by dr_ (32078 rep)
Dec 16, 2016, 03:22 PM
Last activity: Jun 27, 2019, 06:46 PM