Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

command for display home directory??

Status
Not open for further replies.

tusifx

Programmer
Apr 6, 2003
19
0
0
US
quick question!!

what's the command for displaying your home directory?

not 'pwd' because that's for current directory.

 
In the Korn shell you can type...
[tt]
print ~
[/tt]
...to print your home directory, or...
[tt]
print ~username
[/tt]
...to print some user's home directory. You can use the tilda (~) to [tt]cd[/tt] or refer to files. Something like...
[tt]
cp ~smithj/.profile ~
[/tt]
This command would copy [tt]smithj[/tt]'s .profile to my home directory, regardless of what my [tt]pwd[/tt] is.

Hope this helps.

 
.....and i thought there is a command for it like pwd....


thanx for your help
 
Hi,

echo $HOME should give your home directory.

regards,
feroz
 
and the Rube Goldberg method...

cat /etc/passwd | grep "^`whoami`:" | awk -F":" '{print $7}'
 
oops, should been $6 not $7 above. was trying to make it more complicated =)
 
haha......i hate awk
it drive me crazy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top