Showing Where You Are

Problem

You are not sure what directory you are in, and the default prompt is not helpful.

Solution

Use the pwd built-in command, or set a more useful prompt (as in Customizing Your Prompt). For example:

bash-2.03$ pwd
/tmp

bash-2.03$ export PS1='[u@h w]$ '
[jp@solaris8 /tmp]$

Discussion

pwd stands for print working directory and takes two options. -L displays your logical path and is the default. -P displays your physical location, which may differ from your logical path if you have followed a symbolic link.The cd command also provides the -P and -L switches.

bash-2.03$ pwd
/tmp/dir2

bash-2.03$ pwd -L
/tmp/dir2

bash-2.03$ pwd -P
/tmp/dir1
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.199.56