The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell script for extracting out the shortest substring from the given starting and en pankajd Shell Programming and Scripting 18 03-10-2008 06:20 AM
HOME env ilko_partizan High Level Programming 1 02-27-2008 04:23 PM
HOME env ilko_partizan Shell Programming and Scripting 1 02-27-2008 07:15 AM
help for shell script of finding shortest substring from given string by user pankajd Shell Programming and Scripting 1 11-22-2007 12:27 PM
$HOME is not getting it's value. radhika Shell Programming and Scripting 4 06-01-2005 08:52 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-02-2008
incipientmind incipientmind is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 1
Shortest way to home dicrectory

hi guys, i am looking for the shortest way to get to home directory using Absolute & Relative paths.

Anything except cd or cd/home/user

any help would be deeply appreciated.
  #2 (permalink)  
Old 02-02-2008
Prahlad Prahlad is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 11
hi,

You can use following command.

--------
cd ~username
--------

But as you mentioned you don't to use CD at all. I dont think that would be possible.

Thanks,
  #3 (permalink)  
Old 02-02-2008
Lakris Lakris is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 240
If it is Your own home directory You want to go to,
Code:
cd ~
  #4 (permalink)  
Old 02-03-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 921
cd ~ will not work on bourne shells (the default for many unix'es)

I'm assuming by 'anything except cd...' you mean it as it's written (ie cd with no options to get to the home dir).
In which case, cd $HOME should sort you out.

If you want something foolproof though:
Code:
cd `grep -e "^username:" /etc/passwd | cut -d ':' -f 6`
is the only real way to be certain.
Depending on the version of grep, you may need to use egrep, or omit the -e flag.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 07:51 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0