Using the unix command line, the most commonly used tool is pwd. It prints the working directory, meaning the directory the console is currently targeted at. This is done by simply writing the current value of the global variable $PWD to the screen. You can do this by hand using echo $PWD. If you change the directory with cd, you change the variable $PWD and, therefore, the output of the command pwd. For convinience, the system stores the previous value of $PWD in the variable $OLDPWD. This $OLDPWD variable can be printed to the screen using echo $OLDPWD.
Tip: Using cd –, you can change the working directory to the previous working directory.
user@host /test $ pwd /test user@host /test $ echo $PWD /test user@host /test $ cd sub user@host /test/sub $ pwd /test/sub user@host /test/sub $ echo $OLDPWD /test user@host /test/sub $ cd - user@host /test $ cd - user@host /test/sub $
Note: global variables should be written in capital letters, as shown above. Use lower case letters for your own local variables!
PS: Note the all new, well designed favicon!