What is difference between pwd and .

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers What is difference between pwd and .
# 1  
Old 06-16-2011
What is difference between pwd and .

Difference between pwd (present working directory) and . (current working directory).

Last edited by dhami111; 06-16-2011 at 10:37 AM..
# 2  
Old 06-16-2011
pwd is a command which prints the working directory. PWD is an environmental variable in the bash shell which allows you to determine the cwd in a script without resorting to calling the pwd command (OLDPWD is the previous working directory used by cd -).

. is a way of addressing the current working directory in a shell, however it is a relative path rather than an absolute one, both have their place.
# 3  
Old 06-16-2011
The filename . (dot) represents the current working directory. The pwd command displays the absolute pathname of the current working directory to the computer screen. Use the -P option to display the physical current working directory (all symbolic links resolved).
E.g. The directory /opt/strs4-hertog/log is a symbolic link to /opt/civision/spool/streamserve
# cd /opt/strs4-hertog/log
# pwd
# pwd -P

Last edited by Yogesh Sawant; 06-16-2011 at 06:44 PM.. Reason: added code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers


Hi all,when I cd to an environment variable "cd $MYDIR, if I type pwd, I don't the path to the environment variable dir I cd to. Appreciate the help, regards..Abbya (5 Replies)
Discussion started by: abbya
5 Replies

2. Shell Programming and Scripting

Difference beween $PATH and $PWD

Hi i am in learning phase of unix. i am not able to understand the difference between $PATH and $PWD below the the output which i am getting . $ echo $PATH /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/guest/khare/bin $ echo $PWD /home/guest/khare... (2 Replies)
Discussion started by: scriptor
2 Replies

3. UNIX for Dummies Questions & Answers

$PWD vs `pwd`

Hi, can anyone expalin the real importance of PWD as a variable. However pwd command and $PWD is going to give the same result, then why do we have 2 different things. Please give some example which illustrates the difference between both. Thanks (9 Replies)
Discussion started by: pandeesh
9 Replies

4. UNIX for Dummies Questions & Answers

pwd help

Dear users, One more question, In unix when i use pwd the following I get: pwd /Users/username/src/directory name Is there a way to get the out put like this in which the if there is a space in the directory eg directory name it should show as directory\ name:... (2 Replies)
Discussion started by: kevincobain2000
2 Replies

5. AIX

sync samba pwd with aix5.3 pwd

currently, my samba login works just fine. i want my clients to use aix5.3 account to login to samba so they don't have to change samba pwd and aix pwd. i googled, and vi /usr/lib/smb.conf per some of knowledge base, but i could not get to work. aix5.3 and samba thanks in advace..... (2 Replies)
Discussion started by: tjmannonline
2 Replies

6. UNIX for Advanced & Expert Users

echo ${PWD#${PWD%/*/*}/}

Can anyone explain this in detail ... echo ${PWD#${PWD%/*/*}/} Thanks in Advance (1 Reply)
Discussion started by: sakthi.abdullah
1 Replies

7. UNIX for Dummies Questions & Answers


Home directory mounted on one local system as /home/username, same directory mounted on a remote system as /home/engr/username. How to use command to use remote host pwd. For example rsh <remote host> ls -l ~pwd (2 Replies)
Discussion started by: bugsandbunny
2 Replies

8. Shell Programming and Scripting

help on PWD

Hi, We all know that pwd (or echo $PWD) gives us the present working dir as output.... but my doubt is that I'ld like to know how to get the present working folder - I mean - name of the current folder alone.. using pwd command I get the full folder name (right from root path)... I need to know... (2 Replies)
Discussion started by: mohanprabu
2 Replies

9. Shell Programming and Scripting

replacing with `pwd`

Hi E(uni)xperts, I have a file in which I need to replace some text with the current path of the execution. meaning.. if I am running from /user/oldtrash/scripts and the file contains "this is ur directory current_dir" then I should see the file content as "this is ur... (6 Replies)
Discussion started by: oldtrash
6 Replies

10. UNIX for Dummies Questions & Answers

csh - pwd

Im using csh - how can i get the prompt to display my working directory as i navigate up/down. i.e root@host1:/usr/bin Also - i would like to hightlight the prompt in a color - is this possible and how can i do this. I am using Refelection X Thanks (1 Reply)
Discussion started by: hitz
1 Replies
Login or Register to Ask a Question