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 online now Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 31 October 2014, 8:46 AM EDT
Location: NM
Posts: 10,253
Thanks: 285
Thanked 803 Times in 747 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: 30 October 2014, 6:26 PM EDT
Location: Saskatchewan
Posts: 19,733
Thanks: 830
Thanked 3,373 Times in 3,160 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: 30 October 2014, 11:42 PM EDT
Location: Paris
Posts: 4,434
Thanks: 16
Thanked 474 Times in 427 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: 30 October 2014, 6:26 PM EDT
Location: Saskatchewan
Posts: 19,733
Thanks: 830
Thanked 3,373 Times in 3,160 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 09:18 AM
How can I do aliasing in shellscript? arun508.gatike UNIX for Dummies Questions & Answers 9 01-06-2012 08:29 AM
aliasing the TO name in Unix mails bsandeep_80 UNIX for Advanced & Expert Users 3 03-26-2008 03:54 PM
What is IP aliasing ? preethgideon UNIX for Dummies Questions & Answers 2 02-06-2007 10:30 PM
Basic regarding aliasing chanakyahere UNIX for Dummies Questions & Answers 1 01-06-2006 06:32 AM



All times are GMT -4. The time now is 08:50 AM.