The “cd -” is used to switch between current and last used directories in bash command line. Following example shows a sample session.

[neo@techpulp dir1]# cd ../dir2
[neo@techpulp dir2]# pwd
/home/neo/dir2
[neo@techpulp dir2]# cd -
[neo@techpulp dir1]# pwd
/home/neo/dir1
[neo@techpulp dir1]# cd -
[neo@techpulp dir2]# pwd
/home/neo/dir2