Directory Aliasing | Unix Linux Forums | Solaris

  Go Back    


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

Directory Aliasing

Solaris


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-06-2013
shubh05 shubh05 is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 7 March 2013, 4:31 AM EST
Location: India
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Directory Aliasing

Hello,

I need to rediret the directory location at run time as:-

If I type cd /dir1/dir2 then it should take me to /dir1/dir3 at run time.

Inside dir1, both dir2 and dir3 directories are present.

Could anyone guild me over it?

Thanks
Shubham
Sponsored Links
    #2  
Old 03-06-2013
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 28 November 2014, 8:27 PM EST
Location: NM
Posts: 10,285
Thanks: 288
Thanked 816 Times in 758 Posts
There are no good ways to alias a directory, except using symlinks.

So you need to explain carefully the difference between "run time" and other times. Plus.
You do realize that doing this will have major side effects, like not being able to ever get into /dir/dir2 during run time.
Sponsored Links
    #3  
Old 03-06-2013
shubh05 shubh05 is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 7 March 2013, 4:31 AM EST
Location: India
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Hello,

By run time I mean, whenever the command below is executed:-

cd /dir1/dir2 then it should land me in /dir1/dir3.

As fas as I know, symbolic links can't be used for folders/directories. Its for files.

Please correct me If I am wrong and let me know further on it.

Thanks
Shubham
    #4  
Old 03-06-2013
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 28 November 2014, 4:08 PM EST
Location: Saskatchewan
Posts: 19,944
Thanks: 848
Thanked 3,422 Times in 3,207 Posts
Quote:
Originally Posted by shubh05 View Post
As fas as I know, symbolic links can't be used for folders/directories. Its for files.

Please correct me If I am wrong and let me know further on it.
Symbolic links work just fine for folders. You can't hardlink a folder, but symlinks can link to anything. You can even make a symlink that goes nowhere if you really want. It's just a string, in the end.


Code:
ln -s /absolute/path/of/destination /absolute/path/to/source

Absolute paths are reccomended since it takes the destination path completely literally without considering the current working directory at all.
Sponsored Links
    #5  
Old 03-06-2013
jlliagre jlliagre is offline Forum Advisor  
ɹǝsn sıɹɐlos
 
Join Date: Dec 2007
Last Activity: 28 November 2014, 3:33 PM EST
Location: Paris
Posts: 4,455
Thanks: 17
Thanked 480 Times in 432 Posts
Note that under Solaris, you can also use lofs to mount a directory to another one.
eg:

Code:
# mount -F lofs /dir1/dir3 /dir1/dir2

Sponsored Links
    #6  
Old 03-06-2013
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 28 November 2014, 4:08 PM EST
Location: Saskatchewan
Posts: 19,944
Thanks: 848
Thanked 3,422 Times in 3,207 Posts
Is this persistent? Will it disappear on reboot?
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
aliasing command marahtia Homework & Coursework Questions 3 02-27-2012 10:18 AM
How can I do aliasing in shellscript? arun508.gatike UNIX for Dummies Questions & Answers 9 01-06-2012 09:29 AM
aliasing the TO name in Unix mails bsandeep_80 UNIX for Advanced & Expert Users 3 03-26-2008 04:54 PM
What is IP aliasing ? preethgideon UNIX for Dummies Questions & Answers 2 02-06-2007 11:30 PM
Basic regarding aliasing chanakyahere UNIX for Dummies Questions & Answers 1 01-06-2006 07:32 AM



All times are GMT -4. The time now is 10:21 PM.